Macro to Hide Rows with a Condition

markf5998

Board Regular
Joined
Jan 13, 2011
Messages
103
I have a worksheet where AU6:AU55 contain a number which is zero or greater.

I'd like to be able to hide rows where AU6:AU55 = 0, but only after the last time AU6:AU55 was >0.

For example, if [AU6=1, AU7=0,AU8=1] then AU9:AU55 should be hidden and AU7 should remain visible, since there was a >0 after it.

I tried to search for similar problems, but I don't know enough VB to modify code that I found to fit this condition. Thanks for any suggestions!!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
ok so I tested that and it gives "label not defined" in VBA

Thanks for that, I'm sure I'm using a macro somewhere with a GoTo 0 in and it definitely doesn't have a 0 as a separate line.

I will investigate.......

Although, I guess if the GoTo 0 never gets called, it's irrelevant?
 
Upvote 0
Texasalynn - Thanks for the reply...I tried your code and it hides everything after the first blank row.

Chuckles - The code without the 0 in it results in a "Compile Error: Label Not Defined"

Thanks!!
 
Upvote 0
hmm - works with my test but I'll take a look at it. Or are you satisfied with the earlier answer?
 
Upvote 0
Earlier answer is working as needed, but if you want me to test your code for "fun" (!!) I will gladly do it!
 
Upvote 0

Forum statistics

Threads
1,224,620
Messages
6,179,927
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top