Code to Select ActiveSheet and any subsequent sheets until the end of the workbook (unspecified number of sheets)

assistart

New Member
Joined
Apr 17, 2013
Messages
3
The closest code I've tried so far was found elsewhere on this site as the following... but that was for a user that wanted to specifically start with the third worksheet. I modified it to change Worksheets (3) to ActiveSheet, but then it still returns to worksheet 4. How can I just get it to select the current & subsequent sheets without specifying numbers? The ultimate goal is to be able to manually select a row to delete, click a macro button, and have it delete the selected row(s) through the remaining worksheets (leaving the previous worksheets intact). Then I'm going to need a separate one to insert a new row across the subsequent sheets too. I'm pretty new to vba coding - any help would be GREATLY appreciated!!! Thanks!
Code:

Sub Test() Dim x As Integer ThisWorkbook.Worksheets(3).Select For x = 4 To ThisWorkbook.Worksheets.Count Worksheets(x).Select (False) Next xEnd Sub</pre>


 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
what actually you want to do can you explain in details ?
 
Upvote 0
I want to select a row to delete by clicking on it, then I want to run a macro that will select the current worksheet (activeSheet), and ALL subsequent worksheets (no matter how many there will be), and delete that row on the current sheet & every subsequent sheet (but not previous sheets). So, say I'm on worksheet 5 - I would want the changes to be made in sheets 5 through the end, but not 1-4.
Likewise, I also want to be able to add a row in the same manner: select a place I would like to insert a row, then run a macro to select the activeSheet and ALL subsequent sheets and insert a row in that spot (but not in previous sheets).

Let me know if I explained that well or not. :-S
 
Upvote 0
I can't find a previous question anywhere asking the same thing. Please tell me that this is possible to do! Anyone? Thanks!
 
Upvote 0

Forum statistics

Threads
1,203,543
Messages
6,056,023
Members
444,840
Latest member
RazzelDazel

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