Going sheet 2 sheet of workbook; but skipping one sheet.

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
765
Hello friends, hope all is well!

The code here hops from 1 sheet to the other, and when it reaches the last sheet, it goes back to the first sheet.

Can you please help me with the code. I want the code skipping going to: Sheets3.

Thank you so much in advance!

Code:
Sub MoveNext()
 On Error Resume Next
 
 If Not ActiveWorkbook Is ThisWorkbook Then Exit Sub

 Sheets(ActiveSheet.Index + 1).Activate
 
 Range("a1").Select
 
 If Err.Number <> 0 Then Sheets(1).Activate
 
 Range("a1").Select
 End Sub

Code:
Sub MyMacro()

Call MoveNext
Application.OnTime Now + TimeValue("00:00:03"), "mymacro"
End Sub
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about
Code:
Sub MoveNext()
   Dim x As Long
   On Error Resume Next
   
   If Not ActiveWorkbook Is ThisWorkbook Then Exit Sub
   x = ActiveSheet.Index
   Sheets(IIf(x = 2, 4, x + 1)).Activate
   
   Range("a1").Select
   
   If Err.Number <> 0 Then Sheets(1).Activate
   
   Range("a1").Select
 End Sub
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top