I am trying to automate a simple function that resets shapes to a specified location.
For instance, let's say there are 4 blue squares on your worksheet, titled Blue1-Blue4.
The following lines of code accomplish what I wish to do:
But this requires 4 repititions of those two lines of code. I am looking for a loop that will allow me to make this happen to all the squares at once, as I have a lot more than 4 blue squares. Something along the lines of:
Additional information:
Yes I want the shapes to all go to the same place.
Thanks in advance to anyone who can help.
-Rob
For instance, let's say there are 4 blue squares on your worksheet, titled Blue1-Blue4.
The following lines of code accomplish what I wish to do:
Code:
ActiveSheet.Shapes("blue4").Left = 20
ActiveSheet.Shapes("blue4").Top = 40
But this requires 4 repititions of those two lines of code. I am looking for a loop that will allow me to make this happen to all the squares at once, as I have a lot more than 4 blue squares. Something along the lines of:
Code:
For i = 1 To 4
ActiveSheet.Shapes("Blue" & i).Left = 20
ActiveSheet.Shapes("Blue" & i).Top = 40
Next i
Yes I want the shapes to all go to the same place.
Thanks in advance to anyone who can help.
-Rob
Comment