View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Next Worksheet in code

Your subroutine can be reduced to this one-liner...

Sub ActivateNextSheet()
Sheets(1 + (Sheets.Count + ActiveSheet.Index) Mod 3).Activate
End Sub

Rick


"Ardus Petus" wrote in message
...
Sub ActivateNextSheet()
Dim index As Integer
index = ActiveSheet.index
If index < Sheets.Count Then
Sheets(index + 1).Activate
Else
Sheets(1).Activate
End If
End Sub


HTH
--
AP

"Gary S" a écrit dans le message de
news: ...
Basic vba question.

How do I go to the next worksheet using code?
--
Thanks for your help!
Gary S