ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   from "all sheets except" to "all sheets after" (https://www.excelbanter.com/excel-programming/427206-all-sheets-except-all-sheets-after.html)

J.W. Aldridge

from "all sheets except" to "all sheets after"
 

How do I change the following to refer to all sheets after rather than
all sheets except

Reason is, I am adding an additional sheet to the beginning of the
workbook.


On Error Resume Next
For Each ws In Worksheets
If ws.Name < "Data Sheet" Then

Jacob Skaria

from "all sheets except" to "all sheets after"
 
For Each ws In Worksheets
If ws.Index Sheets("Data Sheet").Index Then
'your code
End If
Next

If this post helps click Yes
---------------
Jacob Skaria


"J.W. Aldridge" wrote:


How do I change the following to refer to all sheets after rather than
all sheets except

Reason is, I am adding an additional sheet to the beginning of the
workbook.


On Error Resume Next
For Each ws In Worksheets
If ws.Name < "Data Sheet" Then


Dave Peterson

from "all sheets except" to "all sheets after"
 
for each ws in worksheets
msgbox ws.name 'for example
next ws



"J.W. Aldridge" wrote:

How do I change the following to refer to all sheets after rather than
all sheets except

Reason is, I am adding an additional sheet to the beginning of the
workbook.

On Error Resume Next
For Each ws In Worksheets
If ws.Name < "Data Sheet" Then


--

Dave Peterson

[email protected]

from "all sheets except" to "all sheets after"
 
On Apr 20, 12:09*pm, "J.W. Aldridge"
wrote:
How do I change the following to refer to all sheets after rather than
all sheets except

Reason is, I am adding an additional sheet to the beginning of the
workbook.

On Error Resume Next
For Each ws In Worksheets
If ws.Name < "Data Sheet" Then


Provided that all of your sheets are worksheets:

Best,

Matthew Herbert

Sub CertainSheets()
Dim intWksMarker As Integer
Dim intA As Integer

intWksMarker = Worksheets("Data Sheet").Index
intWksMarker = intWksMarker + 1

For intA = intWksMarker To Worksheets.Count
MsgBox Worksheets(intA).Name
Next

End Sub


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com