If then, hidden rows

  • Thread starter Thread starter pgarcia
  • Start date Start date
P

pgarcia

Hello all,
If rows a4-a10 are hidden, then un-hide, but if they are un-hidden, then hide.
Looking for a VB.

Thanks.
 
This should work (just set the worksheet reference according to your
needs)...

Dim R As Range
For Each R In Worksheets("Sheet1").Rows("4:10")
R.Hidden = Not R.Hidden
Next

Rick
 
GOD, I have to take a class one of these days.
Thanks you very much. It's got a cool "wow" factor when I have the VB code
in a com button.
 
That seems to be simply unhiding all the hidden rows in that range for me;
it does seem to hide the currently unhidden ones. Are you seeing it work
differently than that?

Rick
 
Actually, in looking at it closer, it seem to be setting the Hidden property
of the entire range to the opposite of what Row 4's (the first row in the
range's) Hidden property is set to.

Rick
 

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