Activive sheet -2.select?


Posted by PaulMagruder on June 27, 2001 10:59 AM

Is there code that will allow me to select 2 sheets to the left of the active sheet?

Thanks
Paul



Posted by faster on June 27, 2001 11:30 AM

Sub STS()
'trap error of code ran from sheet index 1 or 2
On Error GoTo Etrap
Dim MyPos
MyPos = ActiveSheet.Index

Sheets(Array(Sheets(MyPos - 1).Name, Sheets(MyPos - 2).Name)).Select

Sheets(MyPos - 2).Activate
Exit Sub

Etrap:
Beep
Exit Sub

End Sub