i have multiple unbound rectangle controls on a form (say 100 or so named Box00, Box02,...Box99 ). I assign each rectangle to a group (A to Z) using the Tag value for the control. In my application I want to be able to click one of 26 control buttons (A, B, C .....Z) and the rectangles that belong to that group will be displayed differently.
The main thing I'm looking for is how to write VBA code that operates on all the boxes without me having to code their names individally. Ie is there a way to say
For all rectangle controls in this form
...do this
...and this
Next
Otherwise I am confident I could write the coding as follows but it seems inefficient (Please ignore the VBA syntax accuracy..newbie who dabbles ocassionally...I'm not looking for spell checks at this point, just logic/command flow help and what's possible before I beat my head against a wall.
If Box00.Tagvalue= MatchTagBox00.BorderWidth =6Else
Box00.BorderWidth =1EndIf
If Box01.Tagvalue= MatchTagBox01.BorderWidth =6Else
Box01.BorderWidth =1EndIf
If Box02.Tagvalue= MatchTagBox02.BorderWidth =6Else
Box02.BorderWidth =1EndIf
....... up to Box99
....
Next