If function with two results required

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using Excel 2003, have a workbook with multiple linked tabs and one page
(printout tab), I want to hide rows with no data automatically (not manually).

Currently using this function: =IF('Bid Form'!B16=0,"",'Bid Form'!$A16 &"A")
Can I substitute the "" with some command to make it hide the entire row
(when B16=0)??
 
No, functions can only return values to their calling cells, they can't
format/hide/etc.

You could use an event macro to do this automatically. Put something
like this in your worksheet code module (right-click the worksheet tab
and choose View Code):

Private Sub Worksheet_Calculate()
Dim rCell As Range
On Error GoTo ErrHandler
Application.EnableEvents = False
For Each rCell In Range("B2:B" & Range("B" & _
Rows.Count).End(xlUp).Row)
With rCell
.EntireRow.Hidden = (.Value = vbNullString)
End With
Next rCell
ErrHandler:
Application.EnableEvents = True
End Sub
 
I think this is going to work.. will need to tweak a little to do line by line
 

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

Back
Top