itsgrady
Board Regular
- Joined
- Sep 11, 2022
- Messages
- 132
- Office Version
- 2021
- Platform
- Windows
- MacOS
I’m not able to add the code to unhide all rows after printing. It keeps saying broken code. I would like unhide all rows after printing. Thanks for the help.
Sub Hide_Unhide_Rows()
Dim sPass As String
sPass = InputBox("Hello Grady, I hope you enjoy the print job!", "Password")
If sPass = "again" Then ' Your password is "again"
Else
MsgBox " Incorrect Password, Try Again. "
Exit Sub
End If
ActiveSheet.Unprotect
For Each cell In Range("B23:B67")
If cell.Value = "14" Then cell.EntireRow.Hidden = True
If cell.Value = "<14" Then cell.EntireRow.Hidden = False
Next cell
ActiveWindow.SmallScroll Down:=-16
Application.Goto Reference:="Print_Area"
ActiveWindow.SmallScroll Down:=-62
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowSorting:=True, AllowFiltering:=True
End Sub
Sub Hide_Unhide_Rows()
Dim sPass As String
sPass = InputBox("Hello Grady, I hope you enjoy the print job!", "Password")
If sPass = "again" Then ' Your password is "again"
Else
MsgBox " Incorrect Password, Try Again. "
Exit Sub
End If
ActiveSheet.Unprotect
For Each cell In Range("B23:B67")
If cell.Value = "14" Then cell.EntireRow.Hidden = True
If cell.Value = "<14" Then cell.EntireRow.Hidden = False
Next cell
ActiveWindow.SmallScroll Down:=-16
Application.Goto Reference:="Print_Area"
ActiveWindow.SmallScroll Down:=-62
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowSorting:=True, AllowFiltering:=True
End Sub