View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How to auto hide a row if the first cell is blank?

First, change your formula in A25 to

=IF(A24=33,"Please Input Data","")

note: no space in last argument and quotes not needed for numeric entries.

Then copy/paste this into your sheet module.

Private Sub Worksheet_Calculate()
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("A25")
If .Value = "" Then
.EntireRow.Hidden = True
Else
.EntireRow.Hidden = False
End If
End With
stoppit:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP


On Wed, 31 Dec 2008 10:18:07 -0800, TG wrote:

Ok I have checked for postings on this problem but none of them have an
answer to my "unique" question.

What I want to do is hide an entire row if the first cell is blank but the
"blank" cell has a formula.
For example:
Let’s say cell A25 has the following formula if(A24="33","Please input
data"," "), so if A24 does not have the number 33 or if it is blank then the
cell A25 will be blank as well, therefore I want the whole entire row to
hide. If A24 has the number 33 then the row should appear with the cell A25
showing "please input data".

I have found similar problems that have solutions that work but only if the
cell is completely blank and with no "hidden" formulas.
(I am by no means well off with VBA or programming, but ill try it if that
is the only way to do so.)

I hope I make some sense


Thank you in advance.
TG