View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default Hiding Rows with Blank cells

Sub HideBlanks()

Dim source As Range
Dim target As Range

Set source = Range("C7:K206")
Set target = source.SpecialCells(xlCellTypeBlanks)
If Not target Is Nothing Then
target.Rows.RowHeight = 0
End If


End Sub

"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