mariokonfortov
New Member
- Joined
- Dec 7, 2011
- Messages
- 24
Hi,
I have twelve consecutive sheets which have a large amount of identical formatting, formulas and validation. I am keen to be able add and remove these thorugh VBA.
When I try to set up a For / Next loop, it seems to run, but only addresses some of the sheets, even though all exist. The same happens when I loop it up or down the sheet numbers and even when I use sheet names.
I am on Excel 2003.
Any ideas why? Would an Array work faster?
I have twelve consecutive sheets which have a large amount of identical formatting, formulas and validation. I am keen to be able add and remove these thorugh VBA.
When I try to set up a For / Next loop, it seems to run, but only addresses some of the sheets, even though all exist. The same happens when I loop it up or down the sheet numbers and even when I use sheet names.
I am on Excel 2003.
Code:
Dim x As Integer
For x = 1 To 12
With Worksheets(x)
.Range("A14:A44").ClearContents
End With
Next x
Any ideas why? Would an Array work faster?