View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Hiding Rows with Blank cells

How about this one?

Sub hideemptyrows()
For i = Cells(Rows.Count, "c").End(xlUp).Row To 2 Step -1
If Cells(i, Columns.Count).End(xlToLeft).Column _
= 1 Then Rows(i).Hidden = True
Next i
End Sub

or
Sub hideemptyrows()
For i = 206 To 2 Step -1
If Cells(i, Columns.Count).End(xlToLeft).Column _
= 1 Then Rows(i).Hidden = True
Next i
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"GoBucks" wrote in message
...
I currently have the code below for a button that will unhide last 175 rows
in my worksheet. I now would like to have it hide the rows that are blank
in
in the range (C7:BL206) looking from the bottom up. For example, if there
were any values in the cells (from Columns C to K only) in row 190, the
macro
would only hide rows 191 thru 206. Any suggestions??

Private Sub CommandButton2_Click()
ActiveSheet.Unprotect Password:=""
Range("A32:A206").EntireRow.Hidden = False
ActiveSheet.Protect Password:=""
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
End Sub