Hide columns based on row values
Hi all,
I am trying to put together a macro to achieve the following: I have formulas in row 5 of my worksheet in columns A through VF. These formulas return in each cell from A5 through VF5 either the result "PRINT" or "" (blank). I need the code for a macro which will say: "if A5 = "PRINT", then do not hide column A. If A5 = "" (blank/empty cell - other than the formula that in that cell) then hide column A. I want it then to do that same for columns B through VF so that the columns for each cell that returns "PRINT" will not be hidden and the columns for each cell that return "" will be hidden. To be even more of a pest, if there is any way for this macro to run in real time (ie, to recheck, based on user entries in the worksheet, whether a column should be hidden without the user having to manually run the macro) then that would be wonderful... Any help you could all give would be greatly appreciated. B |
Hide columns based on row values
|
Hide columns based on row values
On Friday, March 7, 2014 3:40:29 PM UTC-5, wrote:
Hi all, I am trying to put together a macro to achieve the following: I have formulas in row 5 of my worksheet in columns A through VF. These formulas return in each cell from A5 through VF5 either the result "PRINT" or "" (blank). I need the code for a macro which will say: "if A5 = "PRINT", then do not hide column A. If A5 = "" (blank/empty cell - other than the formula that in that cell) then hide column A. I want it then to do that same for columns B through VF so that the columns for each cell that returns "PRINT" will not be hidden and the columns for each cell that return "" will be hidden. To be even more of a pest, if there is any way for this macro to run in real time (ie, to recheck, based on user entries in the worksheet, whether a column should be hidden without the user having to manually run the macro) then that would be wonderful... Any help you could all give would be greatly appreciated. B Brilliant. Thank you Claus. Worked perfectly! |
All times are GMT +1. The time now is 01:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com