Hi,
The following macro has stopped working and I have no idea why? The debug is stopping on the line with the red text below... "Worksheets (i).Select ReplaceFlag"
(I'm running MSOffice 12624.20588)
Please would somebody be able to assist?
Thanks!
Mark
Sub Collapse_Columns_Save_PDF()
'Macro collapses Columns and Rows between the START and END tabs, then saves as PDF
Dim currentSheet As Worksheet
Dim replaceFlag As Boolean
Dim i As Long
With ThisWorkbook
replaceFlag = True
Set currentSheet = .ActiveSheet
'Step 1 - Collapse all Columns & Rows between the START & END tabs
For i = .Worksheets("Start -->").Index + 1 To .Worksheets("<-- End").Index - 1
.Worksheets(i).Outline.ShowLevels RowLevels:=1, ColumnLevels:=1
.Worksheets(i).Select replaceFlag
replaceFlag = False
'Step 2 - Save all tabs between START & END tabs as a pdf document
Next
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Replace(.FullName, ".xlsb", ".pdf"), _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
currentSheet.Select
End With
End Sub
The following macro has stopped working and I have no idea why? The debug is stopping on the line with the red text below... "Worksheets (i).Select ReplaceFlag"
(I'm running MSOffice 12624.20588)
Please would somebody be able to assist?
Thanks!
Mark
Sub Collapse_Columns_Save_PDF()
'Macro collapses Columns and Rows between the START and END tabs, then saves as PDF
Dim currentSheet As Worksheet
Dim replaceFlag As Boolean
Dim i As Long
With ThisWorkbook
replaceFlag = True
Set currentSheet = .ActiveSheet
'Step 1 - Collapse all Columns & Rows between the START & END tabs
For i = .Worksheets("Start -->").Index + 1 To .Worksheets("<-- End").Index - 1
.Worksheets(i).Outline.ShowLevels RowLevels:=1, ColumnLevels:=1
.Worksheets(i).Select replaceFlag
replaceFlag = False
'Step 2 - Save all tabs between START & END tabs as a pdf document
Next
.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Replace(.FullName, ".xlsb", ".pdf"), _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
currentSheet.Select
End With
End Sub