Selecting Next Worksheet
Without seeing your "actions to be done code" hard to tell.
This code does the job as advertised.
Sub shtsprotect()
Dim sht As Worksheet
For Each sht In ThisWorkbook.Worksheets
sht.Protect Password:="justme"
Next sht
End Sub
Gord Dibben MS Excel MVP
On Sat, 20 Jan 2007 17:56:02 -0800, BSII wrote:
I'm looking for some code to perform the same group of operations on each
worksheet in a workbook. It seems to be a very simple operation, but I can't
seem to get it to work. I have tried the following:
Sub Timesheet_Format()
Dim sht As Worksheet
For Each sht In ThisWorkbook.Worksheets
' ACTIONS TO BE DONE
Next
End Sub
It runs ok for the current worksheet, but doesn't go on to any of the
others. Any suggestions on what I'm doing wrong?
Thanks...
|