Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to hide # of columns based on value
I am trying to write a macro which will hide certain columns based upon the
value of a cell. For example, if cell value = 1, hide columns A:Q, if value = 2, hide columns B:Q, if value = 3, hide C:Q and so on. Is there a quick way of doing this. Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to hide # of columns based on value
not much info to work with, i used cell T1 on sheet1 as the value for the
first column Sub test() Dim colnum As Long Dim ws As Worksheet Set ws = Worksheets("sheet1") colnum = ws.Range("t1").Value With ws .Columns(colnum).Resize(, 18 - colnum).EntireColumn.Hidden = True End With End Sub -- Gary Keramidas "Graeme" wrote in message ... I am trying to write a macro which will hide certain columns based upon the value of a cell. For example, if cell value = 1, hide columns A:Q, if value = 2, hide columns B:Q, if value = 3, hide C:Q and so on. Is there a quick way of doing this. Thank you. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to hide # of columns based on value
Thank you.
"Gary Keramidas" wrote: not much info to work with, i used cell T1 on sheet1 as the value for the first column Sub test() Dim colnum As Long Dim ws As Worksheet Set ws = Worksheets("sheet1") colnum = ws.Range("t1").Value With ws .Columns(colnum).Resize(, 18 - colnum).EntireColumn.Hidden = True End With End Sub -- Gary Keramidas "Graeme" wrote in message ... I am trying to write a macro which will hide certain columns based upon the value of a cell. For example, if cell value = 1, hide columns A:Q, if value = 2, hide columns B:Q, if value = 3, hide C:Q and so on. Is there a quick way of doing this. Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hide Columns based on a cell value | Excel Worksheet Functions | |||
Writing a macro to hide columns based on cell value | Excel Discussion (Misc queries) | |||
Hide Columns Based on Condition | Excel Programming | |||
hide columns based on header macro | Excel Programming | |||
Macro to Hide/Show Columns based on control cell value | Excel Programming |