ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excluding one page in a macro (https://www.excelbanter.com/excel-programming/400775-excluding-one-page-macro.html)

Brad

Excluding one page in a macro
 
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.

Charles Chickering

Excluding one page in a macro
 
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
--
Charles Chickering

"A good example is twice the value of good advice."


"Brad" wrote:

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.


Brad

Excluding one page in a macro
 
Thank you!!

"Charles Chickering" wrote:

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
--
Charles Chickering

"A good example is twice the value of good advice."


"Brad" wrote:

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.



All times are GMT +1. The time now is 07:08 PM.

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