I have a macro attached to an icon that will unlock the sheet, hide certain rows and column, bring up the application dialog to print and the unhide everything upon the print dialog box being closed and lock the sheet back up. Problem is, the print dialog doesn't seem to acutally print. Any ideas? I tried to label all the code to explain what my intent is. Hopefully this helps.
Thanks in advance...
Code:
Sub PrintwithHide()
ActiveSheet.Unprotect Password:="TESTING"
'Hide the Columns
Dim C As Range
For Each C In Range("AA6:BW6").Cells
If C.Value = "TP-" Then
C.EntireColumn.Hidden = True
End If
Next C
'Hide the Rows
Dim d As Range
For Each d In Range("A10:A50").Cells
If d.Value = "" Then
d.EntireRow.Hidden = True
End If
Next d
'Hide the unnecessary Columns
Range("H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q").Select
Range("Q5").Activate
Selection.EntireColumn.Hidden = True
Range("A10").Select
'Print
Application.Dialogs(xlDialogPrinterSetup).Show
'Unhidethe unnecessary Columns
Columns("D:Z").Select
Range("Z5").Activate
Selection.EntireColumn.Hidden = False
ActiveWindow.LargeScroll ToRight:=-1
Range("A10").Select
'Unhide the Columns
Dim e As Range
For Each e In Range("AA6:BW6").Cells
If e.Value = "TP-" Then
e.EntireColumn.Hidden = False
End If
Next e
'Unhide the Rows
Dim f As Range
For Each f In Range("A10:A50").Cells
If f.Value = "" Then
f.EntireRow.Hidden = False
End If
Next f
ActiveSheet.Protect Password:="TESTING", AllowInsertingRows:=True, AllowDeletingRows:=True
End Sub
Thanks in advance...