View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Macro to navigate between sheets

Hi Jonsson,

here are 2 macros for you

Sub Forward()
Dim idx As Long
idx = ActiveSheet.Index
If idx < ActiveSheet.Parent.Sheets.Count Then
Sheets(idx + 1).Activate
End If
End Sub

Sub Back()
Dim idx As Long
idx = ActiveSheet.Index
If idx 1 Then
Sheets(idx - 1).Activate
End If

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jonsson " wrote in message
...
Hi all,

I need help to create 2 macro. One that choose the sheet before the
active sheet, and one that choose the sheet after the active sheet,
nomatter whats the name of the sheet.
Just navigate to the sheet left of the active sheet, and right of the
active sheet.


Any help is appreciated!!

//Thomas


---
Message posted from http://www.ExcelForum.com/