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

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
758
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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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