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

  • Thread starter Thread starter J.W. Aldridge
  • Start date Start date
J

J.W. Aldridge

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
 
For Each ws In Worksheets
If ws.Index > Sheets("Data Sheet").Index Then
'your code
End If
Next

If this post helps click Yes
 
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
 
Back
Top