macro - hide rows

W

Will

I will try this again but I do not understand all the
lingo so please lead me.

Cells A2:A60 contain formulas that return a result of
either "" or a number. Question is - Could the result
of "" from that formula (say in A4) be enough to trigger
HIDING row 4 ?? I will unhide them as I need unless it is
possible at the same time to unhide row 4 should the
result of A4 ever become a number.
If possible please do tell. I went the wrong route before
by right clicking the sheet tab and going to view code.

Thanks greatly for any help........Will
 
E

Eric

One way that I found that worked for this is the following:

In the Sheet Code area,

Private Sub Worksheet_Calculate()
Dim ToHide as Integer
For ToHide = 2 to 60
If Cells(ToHide, 1).Value = "" Then
Rows(ToHide).Hidden = True
Else
Rows(ToHide).Hidden = False
End If
Next ToHide
End Sub


There may be other ways, but it worked for me. Hope it does the same
for you.
 
R

Rajesh

Will
Try the code below
Rajesh

Sub HideRows()
Dim RowNo As Integer
RowNo = 2
Cells.Select
Selection.EntireRow.Hidden = False
Cells(2, 1).Select
For i = 1 To 59
Cellvalue = Sheets(1).Cells(RowNo, 1).Value
If Cellvalue = "" Then
Add = ActiveCell.Address
Rows(RowNo).Select
Selection.EntireRow.Hidden = True
End If
RowNo = RowNo + 1
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top