Hello, I am try to go through a number of worsheets, unhide them, clear certain cell ranges and hide them again. I was trying the following macro but I seem to get an error and the routine stops. Can anyone suggest why.
but I seem to get an error and the routine stops. Can anyone suggest why.
Dim i As Integer
For i = 1 To 50
Worksheets(i).Visible = xlSheetVisible
Worksheets(i).Select
Range("B12:H12,B16:H16,B20:H20,B24:H24,B28:H28").Select
Selection.ClearContents
Range("b12").Select
ActiveSheet.Visible = xlVeryHidden
Range("w7") = i
Next i
End Sub
The line ACTIVESHEET.VISIBLE=XLVERY HIDDEN is highlighted yellow. It seems to work but stops on the sixth cycle.
Thanks
Colin
but I seem to get an error and the routine stops. Can anyone suggest why.
Dim i As Integer
For i = 1 To 50
Worksheets(i).Visible = xlSheetVisible
Worksheets(i).Select
Range("B12:H12,B16:H16,B20:H20,B24:H24,B28:H28").Select
Selection.ClearContents
Range("b12").Select
ActiveSheet.Visible = xlVeryHidden
Range("w7") = i
Next i
End Sub
The line ACTIVESHEET.VISIBLE=XLVERY HIDDEN is highlighted yellow. It seems to work but stops on the sixth cycle.
Thanks
Colin