Thread: Hiding Rows
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
mr_teacher mr_teacher is offline
external usenet poster
 
Posts: 1
Default Hiding Rows


Hi Bob,

That looks like it will do the trick perfectly!

Where should I place that code to execute it? Should I use the tab to
view code for the sheet or is it elsewhere? Gradually learning about
these things as I go along! The help on here is really helping though!

Thanks a lot

Carl
Bob Phillips Wrote:
This should do it

Sub Test()
Dim i As Long

For i = 7 To 42
Rows(i).Hidden = Cells(i, "B").Value = "zzz" And Cells(i, "C").Value
= "zzz"
End If

For i = 166 To 196
Rows(i).Hidden = Cells(i, "B").Value = "zzz" And Cells(i, "C").Value
= "zzz"
End If

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"mr_teacher"
wrote
in message
...

The data in the table is found from a VLOOKUP from another

worksheet.
There can be a maximum of 35 entries in the table and minimum of

zero.
I would ideally like it where all rows within the table are hidden

if
Columns B and C both contain the text "zzz" (apologies I did put

blank
before but I had forgotten I had applied conditional formatting to

hide
text when it was "zzz") for that particular row and that this would
change on demand based upon results from the table wher it is

looking
up from.

This would firstly be applied to data that is in rows 7 to 42 and

then
secondly to data that is in rows 166 to 196. I would like the

formula
to be looking at these specific ranges but to be able to change to
hidden / unhidden depending upon data being in columns b and c for
them.

Hope that makes a bit more sense? Thanks for all the help!

Carl

Bob Phillips Wrote:
Before I do that, do you want to explain exactly what you want to

do,
so
that I can tailor it.

The code that I gave just hides or unhides row 10 based on columns

B
and C.
Do you want to just run it on the activerow, or a range of rows?

What
are
the rules? Also, do you want to run it on demand, or as those

cells
are
changed?

BTW, once it gets hidden, how do you add data in B and C that

would
cause it
to be unhidden?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"mr_teacher"


wrote
in message
...

Hi Bob,

Thanks for the reply. I am guessing this is a macro code that I

need
to
put in somewhere? I am still pretty much a beginner with these
(pretty
much at the stage where I can record them and have a look at

them
that
way) so if you could tell me how to put it into my workbook that
would
be great.

Bob Phillips Wrote:
Rows(10).Hidden = Cells(10,"B").Value ="" AND

Cells(10,"C").Value =
""



Is the 10 in this referring to a number of rows?

Being more specific, I am looking to apply this rule to rows 7

to
42,
and then rows 166 to 196
Thanks a lot for your help

Carl


--
mr_teacher


------------------------------------------------------------------------
mr_teacher's Profile:
http://www.excelforum.com/member.php...o&userid=34352
View this thread:
http://www.excelforum.com/showthread...hreadid=567408



--
mr_teacher

------------------------------------------------------------------------
mr_teacher's Profile:

http://www.excelforum.com/member.php...o&userid=34352
View this thread:

http://www.excelforum.com/showthread...hreadid=567408



--
mr_teacher
------------------------------------------------------------------------
mr_teacher's Profile: http://www.excelforum.com/member.php...o&userid=34352
View this thread: http://www.excelforum.com/showthread...hreadid=567408