VBA to Auto Hide Rows with N/A as Value

Bkisley

Board Regular
Joined
Jan 5, 2017
Messages
100
Hey guys! I have a macro created that is near perfect for what I need. The only downfall is that it leaves the 50 rows the macro deals with unhidden. I need to add to my macro to hide all rows with rows 56 and 105 that have a value of N/A in column A.

Example - cells A56:A66 all have a percent in the cell. Cells A67:A105 have N/A in the cell. When I click my macro button, I need to automatically hide rows A67:105. If I then add to my data and now A56:A75 now have a percent in the cell, I would need my macro (when clicked for the second time) to leave rows A56:A75 unhidden and hide A76:A105

What do I need to do??


Thanks!
 
Yeah I don't have an issue with doing that. I will then just add in a conditional formatting where if a cell is false use white text so I don't see a bunch of cells that show False.
Thanks again!
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
There's no need to use cf as those cells will be hidden anyway.
 
Upvote 0
If you are happy to change your formula so that, rather returning "N/A" it returns FALSE (no quotes) you could use
Code:
Range("A56:A105").SpecialCells(xlFormulas, xlLogical).EntireRow.Hidden = True
Since the values returned are either numbers or "N/A", he should be able to use this formula without changing the "N/A" to "FALSE"...

Range("A56:A105").SpecialCells(xlFormulas, xlTextValues).EntireRow.Hidden = True
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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