Excluding one page in a macro

G

Guest

I have to modify the following code to exclude one sheet out of 110 pages.
Is there an easy way to do this.

What I would be modifying would be the

Sheets(Array("Page 1", "Page 2", "Page 3")).Select

Sub Macro4()
Sheets(Array("Page 1", "Page 2", "Page 3")).Select
Sheets("Page 1").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"V:\ACMP\Contract Summaries\Maximum Solutions II\EA version\" &
Range("inpdate1").Value & "\IM-006344_EA_" & Range("inpdate1").Value &
".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, OpenAfterPublish:=False

End Sub

Thanks in advance.
 
G

Guest

Brad, try this:

Sub TestSelect()
Dim sh As Object
Dim shAr() As String
Dim cnt As Long
ReDim shAr(0 To ActiveWorkbook.Sheets.Count - 2)
cnt = 0
For Each sh In ActiveWorkbook.Sheets
If sh.Name <> "Sheet2" Then
shAr(cnt) = sh.Name
cnt = cnt + 1
End If
Next
Sheets(shAr).Select
End Sub
 
G

Guest

Thank you!!

Charles Chickering said:
Brad, try this:

Sub TestSelect()
Dim sh As Object
Dim shAr() As String
Dim cnt As Long
ReDim shAr(0 To ActiveWorkbook.Sheets.Count - 2)
cnt = 0
For Each sh In ActiveWorkbook.Sheets
If sh.Name <> "Sheet2" Then
shAr(cnt) = sh.Name
cnt = cnt + 1
End If
Next
Sheets(shAr).Select
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