View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Code Does Not Work Depending On Formula

For the OP,
This wouldn't work for either of the formulas you show as being in column A.

A cell containing a formula is not considered blank.

--
Regards,
Tom Ogilvy

"Don Guillett" wrote in message
...
change to
Sub hiderows()
With ActiveSheet
.Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True
.PrintPreview
.Rows.Hidden = False
End With
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
Sub hiderows()
with yoursheet
.Columns(1).SpecialCells(xlBlanks).EntireRow.Hidde n = True
.print
.rows.visible=true
end with
End Sub

--
Don Guillett
SalesAid Software

"Bob" wrote in message
...
If I use: =IF(Sheet2!D22,Sheet2!D22,"") in column A (with no value)
The code below works.
IfI use: =Sheet2!D22 in column A (with no value)
The code does not work.
Why?
Thanks,
Bob

Private Sub CommandButton1_Click()
Dim rw As Long
Application.ScreenUpdating = False
'Me is the object that owns the code
'in this case Sheet1
With Me 'Sheets("Sheet1")
For rw = 1 To 30
If .Cells(rw, "A").Value = "" Then _
.Rows(rw).Hidden = True
Next rw
.PrintOut ' for testing use .PrintPreview
.Range("A1:A30").EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
End Sub