Hi Dave,
The instruction:
selects (as you might intuitively anticipate) the next sheet.
If, as I suspect in your case, the active sheet is the last sheet, then
the
expression will generate your encountered error.
Of course, in real code, provision would be made to handle this
eventuality
but, here, the instruction was merely used to to effect an intentional
change of selection and any other selection instruction might equally
well
have been used. The intention was merely to demonstrate the return to
a
given location after an intervening selection.
The following example uses ActiveSheet.Next to cycle through the
sheets of
the active workbbook and restart at the first sheet when the last sheet
is
reached:
'=============>>
Sub CycleSheets()
With ActiveSheet
IIf(.Index < Sheets.Count, .Next, Sheets(1)).Select
End With
End Sub
'<<=============
---
Regards,
Norman
"Desert Piranha"
message