通过我的复选框,For Each Next循环有什么顺序 [英] What order does a For Each Next loop through my checkboxes
问题描述
我已经确认它不是CheckBox1,CheckBox2,CheckBox3等的顺序。
对于在工作表上布局的ActiveX复选框控件,< right-click> ,Order命令设置它们在For ...每个循环中检索的顺序。请注意,命令似乎是向后的。
- 带到前面 将形状对象放在For Each队列的尾端。
- 发送到后面 将把Shape对象放在For Each队列的前面。
- 转发 将把形状对象重新排列在队列中的一个位置。
- S结束向后 将向前推动形状对象在队列中的一个位置。
使用工作表(Sheet1)
.Shapes(CheckBox2)。ZOrder msoBringForward'< ~~发回一个地方队列
.Shapes(CheckBox2)。ZOrder msoSendToBack'< ~~在队列开头的位置
结束
使用 Shape .ZOrderPosition属性以确定当前位置。
I have about 20 Check Boxes laid out in a rectangle. How do I know what order my code loops through them with a For Each loop?
I've already confirmed it is not in the order of CheckBox1, CheckBox2, CheckBox3 etc.
For ActiveX checkbox controls laid out on the worksheet, the <right-click>, Order command sets the order they are retrieved in a For ... Each loop. The caveat is that the commands seem to be backwards.
- Bring to Front will place the shape object at the tail end of the For Each queue.
- Send to Back will bring the shape object to the front of the For Each queue.
- Bring Forward will shuffle the shape object back one place in the queue.
- Send Backward will push the shape object forward one place in the queue.
The VBA for this is in the Shape.ZOrder method.
With Worksheets("Sheet1")
.Shapes("CheckBox2").ZOrder msoBringForward '<~~ send back one place in the queue
.Shapes("CheckBox2").ZOrder msoSendToBack '<~~ place at the beginning of the queue
End With
Use the Shape.ZOrderPosition property to determine the current position.
这篇关于通过我的复选框,For Each Next循环有什么顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!