Desired behaviour: Activate a particular sheet in a workbook based on its name.
I've been using the search feature of this forum and found this code snippet.
Sub test()
For Each sht In ActiveWorkbook.Worksheets
"Your code"
Next sht
End Sub
So, to accomplish the above desired behaviour would the below modification to the snippet be correct?
Sub test()
For Each sht In ActiveWorkbook.Worksheets
sht.activate
if activesheet.name = "Sep 05"
Exit
endif
Next sht
End Sub
Also, is there a way to enumerate the sheets without activating them and activate only when the correct sheet is found?
As always, TIA
Steve
I've been using the search feature of this forum and found this code snippet.
Sub test()
For Each sht In ActiveWorkbook.Worksheets
"Your code"
Next sht
End Sub
So, to accomplish the above desired behaviour would the below modification to the snippet be correct?
Sub test()
For Each sht In ActiveWorkbook.Worksheets
sht.activate
if activesheet.name = "Sep 05"
Exit
endif
Next sht
End Sub
Also, is there a way to enumerate the sheets without activating them and activate only when the correct sheet is found?
As always, TIA
Steve