How to start execution from ActiveShett

gopdeep

Board Regular
Joined
Apr 24, 2012
Messages
94
Hi

If am having "N" number of sheets in my workbook, my code should run from active sheet to the last sheet of the workbook.

For instance, consider that my workbook having sheets such as "Sheet1, Sheet2, Sheet3, Sheet4, Sheet5, Sheet6, Sheet7 & Sheet8" here if "Sheet3" is in active means then my code should run from "Sheet3 - Sheet8" and shouldn't run for "Sheet1, Sheet2".

Can anyone help me on this condition ?

Am breaking my head to get an clear code for above condition :hammer:

:help:
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi


Try:


Code:
Sub test()
Dim ws As Worksheet
 
For Each ws In Worksheets
    If ws.Index >= ActiveSheet.Index Then
        ' your code
    End If
Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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