Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot for your feedback.
Unfortunately I was a bit inaccurate when it comes to which columns should be hidden.. Cell A5 will show the value for a month (1-12), and for each month I would like to hide different columns (Value 1 in cell A5 indicates month January, and that columns U to Z should be hidden). Thus the number in cell A5 will not say from which column I should start hiding.. If A5 is 2 (february) I would like to hide column AA to AE etc. For each month I can write the specific columns to be hidden{Columns("U:Z").Select Selection.EntireColumn.Hidden = True}, I just don't know how to indicate that the value in A5 should decide which columns to be hidden, i.e. how to write a macro for: IF worksheet "Menu" cell A5=1, worksheet "output" Columns("U:Z").Select Selection.EntireColumn.Hidden = True You know how to handle this? Thanks! Kristine "Don Guillett" wrote: This should get you going. As written it will hide from the column NUMBER entered in cell a5 on menu. so,if a 5 was entered, it would hide cols e-z. NO selections. Can be fired from anywhere in the workbook. Y Sub hidecolumnsif() mv = Sheets("menu").Range("a5") With Sheets("output") .Columns.Hidden = False .Range(Cells(1, mv), Cells(1, "z")) _ .EntireColumn.Hidden = True End With End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Kristine" wrote in message ... Hi, I do not have much experience in macro programming, but now I would need to make a macro. Can someone please help me?? In one excel worksheet called "Menu" I have put a lookup function in cell (A5). This function presents values 1 to 12 (and cell B5 has a similar lookup function presenting month January to December), depending on value chosen in a drop down list. If value in cell A5 is 1 (January in cell B5), I would like to hide some columns in another worksheet called "Output", say columns U to Z. I think that for hiding the columns I can use: Columns("U:Z").Select Selection.EntireColumn.Hidden = True But I don't know how to start this macro, I don't know how to do the selection of columns depending on the value in cell A5(can I use an IF function?), and how to select the worksheet "Output"?? Can someone please help? Thanks a lot, Kristine |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hiding rows or columns based on cell contents | Excel Discussion (Misc queries) | |||
Hiding columns in a protected sheet | Excel Discussion (Misc queries) | |||
hiding columns, error message says cannot shift objects off sheet | Excel Discussion (Misc queries) | |||
when hiding columns mess: "cannot shift objects off sheet" | Excel Discussion (Misc queries) | |||
Hiding columns, custom views, protected sheet | Excel Discussion (Misc queries) |