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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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,221,418
Messages
6,159,790
Members
451,589
Latest member
Harold14

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