Hiding only Specific Rows using VBA

Grothgar

Board Regular
Joined
Jul 25, 2011
Messages
62
Hi All;

I have a spreadsheet where I have a simple formula. The formula is IF($A2=$B$2,1,0), and then I drag down to the bottom of the spreadsheet, so whenever it matches it shows a 1.
Now, what I need to do using VBA is hide all the rows that do not have 1's on them. I know how to start the VBA, but not how to finish

Code:
Dim LR as Long
LR = Range("A2").End(xlDown).Row

Because that will allow me to only select the row field that I want to do the Macro on.
So, how do I go about hiding rows that only have 0's in them.

Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

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