A Quick VBA to hide all Columns with "i" in row 1?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

I need a fast VBA to hide all Columns Between B and AAZ that have "i" in row 1?

What im trying to do is have a macro that hides certain parts of my document when its not nesseccacary to see them, however the requirements are changing a lot so just listing the columns i want to hide means i have to keep editing the macro,

If i could have a macro that just hides them if they say "i" this would be great but if we try it with a loop it seams to take a long time as it hides each column one at a time, I'm happy to have extra things like a formula or whatever the best idea is i just want to be able to add or remove "I" from row 1 and that column be included in the hide.

any ideas would be welcomed

Thanks

Tony
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
What is in row 1 for the columns you want visible?
 
Upvote 0
Hi sorry its late here and i've lost the ability to read lol,
i'm setting this up to do whatever it needs to at the moment i have row 1 blank except for the cells with "i" in them, but i can add something if need be?
Thanks
Tony
 
Upvote 0
If your cells are truly blank and your i is a constant then you could just use

VBA Code:
Rows("1:1").SpecialCells(xlCellTypeConstants, 23).EntireColumn.Hidden = True
 
Upvote 0
You're welcome...
P.S. Tony it didn't make a difference here but can you at some stage update your profile please so that it shows your Excel/OS version, as it does help us when answering questions.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,873
Messages
6,122,029
Members
449,061
Latest member
TheRealJoaquin

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