Hi, I have the below Macro to route through my Spreadsheet and only print the sheets with data in a certain cell:
Sub CHECKSHEET()
Dim Sh As Worksheet
Dim Arr() As String
Dim N As Integer
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
With ActiveWorkbook
.Worksheets(Arr).PrintOut
End With
End Sub
I also have another macro for another spreadsheet which only prints the one sheet but defines which columns not to print:
Sub W_CHECKSHEET()
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("B1,H1,K1:N1,P1").EntireColumn.Hidden = True
.PrintOut
.Range("B1,H1,K1:N1,P1").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
I have tried to add to the first Macro to define which columns not to print but am not sure how.
Thanks
Sub CHECKSHEET()
Dim Sh As Worksheet
Dim Arr() As String
Dim N As Integer
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
With ActiveWorkbook
.Worksheets(Arr).PrintOut
End With
End Sub
I also have another macro for another spreadsheet which only prints the one sheet but defines which columns not to print:
Sub W_CHECKSHEET()
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
Application.ScreenUpdating = False
With ActiveSheet
.Range("B1,H1,K1:N1,P1").EntireColumn.Hidden = True
.PrintOut
.Range("B1,H1,K1:N1,P1").EntireColumn.Hidden = False
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
I have tried to add to the first Macro to define which columns not to print but am not sure how.
Thanks