Hi, I had this as a private message and thought it best to post it here.
Zeb Sanders's Avatar
Zeb Sanders Zeb Sanders is offline
MS Office Version: 2003
Op System: Windows XP
Assumed Experience: Just above poor (Basic Formulas SUM etc)
Join Date: 30th August 2006
Smile Hide a row before printing based on a cell value.
As I am still learning VB I have been unsuccessful. I have attached the code that I am using, and was hoping if anyone would give me ideas on what I should do, or what I am doing wrong, I would appreciate it.
How do I modify this piece of code to hide Rows ("31:37") when the value in B30 is grater then one? If the value in B30 is less then one I want to print Rows ("31:37") with the rest of the work.
'Private Sub CommandButton1_Click() ' If ActiveSheet.Name = "Sheet1" Then ' Cancel = True ' Application.EnableEvents = False ' Application. ScreenUpdating = False ' With ActiveSheet ' .Rows("31:37").EntireRow.Hidden = True ' .PrintOut ' .Rows("31:37").EntireRow.Hidden = False ' End With ' Application.EnableEvents = True ' Application.ScreenUpdating = True ' End If 'End Sub