is there a forumla to hide rows?

B

Brad

I have a list of sales people in a worksheet and I only want the ones with
info in column c or column d to show up. If both are empty I don't want them
to show. Is there a formula that will hide the row if their is no data in
either of these cells?
 
D

Don Guillett

Formulas cannot do this. They only return values. suggest using
data>filter>autofilter and then filter as desired.
 
J

JulieD

Hi Brad

the only other alternative to Don's suggestion is to use code - which could
run automatically on the opening of the workbook or the selection of the
sheet. However, this does mean that the users have to have enabled macros
(and security settings need to be set to medium).

is this an approach you're interested in?

Cheers
JulieD
 
D

Don Guillett

Then a macro that would fire on activating the worksheet should do it for
you.
 
B

Brad

Thanks, but for now I think I'm just going to drop those cells down on the
sheet so that if they get cut in printing it's not a big deal.
 
T

Toppers

Executes on opening workbook

Sub Auto_Open()

lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Set rnga = Range("C1:C" & lastrow) ' Assume data starts in row 1

For Each c In rnga ' Check C & D for empty and hide row if
both empty
If WorksheetFunction.And(c = "", c.Offset(0, 1) = "") Then
Rows(c.Row).EntireRow.Hidden = True
End If
Next c
End Sub

Hope this helps.
 

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