Thread
:
Makro from value in one cell, hiding columns in another sheet
View Single Post
#
4
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Makro from value in one cell, hiding columns in another sheet
No mind readers here. You need to give a LOT more info or send your workbook
to my address below along with a very clear and detailed description of your
desires. Also copy/paste these emails to a sheet in the wb.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Kristine" wrote in message
...
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
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett