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

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
 
J

Jacob Skaria

For Each ws In Worksheets
If ws.Index > Sheets("Data Sheet").Index Then
'your code
End If
Next

If this post helps click Yes
 
M

meh2030

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top