Hi Steve
Try these two Code snippets.
![]()
Sub CHECKSHEET2() Dim Sh As Worksheet Dim Arr() As String Dim N As Long, i As Long N = 0 For Each Sh In ActiveWorkbook.Worksheets If Sh.Visible = xlSheetVisible And Sh.Range("A101").Value <> "" Then N = N + 1 ReDim Preserve Arr(1 To N) Arr(N) = Sh.Name End If Next For i = LBound(Arr) To UBound(Arr) With Sheets(Arr(i)) .Range("C1:E1,M1").EntireColumn.Hidden = True .PrintPreview 'or PrintOut .Range("C1:E1,M1").EntireColumn.Hidden = False End With Next i End Sub![]()
Sub exportToPdf() Dim strFilePath As String, strPdfName As String Dim Sh As Worksheet Dim Arr() As String Dim N As Long, i As Long strFilePath = ThisWorkbook.Path & "\" Application.ScreenUpdating = False N = 0 For Each Sh In ActiveWorkbook.Worksheets If Sh.Visible = xlSheetVisible And Sh.Range("A101").Value <> "" Then N = N + 1 ReDim Preserve Arr(1 To N) Arr(N) = Sh.Name End If Next For i = LBound(Arr) To UBound(Arr) With Sheets(Arr(i)) .Range("C1:E1,M1").EntireColumn.Hidden = True strPdfName = .Name & ".pdf" .Copy .ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFilePath & strPdfName, _ Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=False .Range("C1:E1,M1").EntireColumn.Hidden = False End With Next i Application.ScreenUpdating = True End Sub











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks