I have two drop downs: one selecting month, and the other a year. I would like it when one of these changes, it runs a macro. Sounds simple...but I could not get anything successfully done.
Any help is much appreciated!
I have two drop downs: one selecting month, and the other a year. I would like it when one of these changes, it runs a macro. Sounds simple...but I could not get anything successfully done.
Any help is much appreciated!
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$A$2" Then 'one of the DD cells
'do your stuff
ElseIf Target.Address = "$A$5" Then 'other DD cells
'do other stuff
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"pikapika13" <[email protected]> wrote
in message news:[email protected]...
>
> I have two drop downs: one selecting month, and the other a year. I
> would like it when one of these changes, it runs a macro. Sounds
> simple...but I could not get anything successfully done.
>
> Any help is much appreciated!
>
>
> --
> pikapika13
> ------------------------------------------------------------------------
> pikapika13's Profile:
http://www.excelforum.com/member.php...o&userid=10892
> View this thread: http://www.excelforum.com/showthread...hreadid=557898
>
I think this is a good start, but I'm still having some problems. I'm still new to VBA. In the address below, am I supposed to put in the linked cell? If so, it doesn't work. Choosing the month will change this cell's value, but the macro won't kick off. However, when I manually change it, it does.
If I'm supposed to have the address be where the DD is located, I don't know how to place the DD in that cell; it seems to just float over it.
"If Target.Address = "$A$7" Then 'one of the DD cells"
I have assumed Data Validation, not a combobox?
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"pikapika13" <[email protected]> wrote
in message news:[email protected]...
>
> I think this is a good start, but I'm still having some problems. I'm
> still new to VBA. In the address below, am I supposed to put in the
> linked cell? If so, it doesn't work. Choosing the month will change
> this cell's value, but the macro won't kick off. However, when I
> manually change it, it does.
>
> If I'm supposed to have the address be where the DD is located, I don't
> know how to place the DD in that cell; it seems to just float over it.
>
>
> "If Target.Address = "$A$7" Then 'one of the DD cells"
>
>
> --
> pikapika13
> ------------------------------------------------------------------------
> pikapika13's Profile:
http://www.excelforum.com/member.php...o&userid=10892
> View this thread: http://www.excelforum.com/showthread...hreadid=557898
>
Wow...I dont' even know the difference. If I right-click on the box and choose format control, the last tab "Control" is availabe to link it to a range, cells, and number of drop down lines. I wouldn't even know how to create this from scatch. I copied this box from somewhere else.
I cannot see that tab on my Excel, neither with a forms button, a controls
toolbox button, so I don't know which you have.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"pikapika13" <[email protected]> wrote
in message news:[email protected]...
>
> Wow...I dont' even know the difference. If I right-click on the box and
> choose format control, the last tab "Control" is availabe to link it to
> a range, cells, and number of drop down lines. I wouldn't even know
> how to create this from scatch. I copied this box from somewhere else.
>
>
> --
> pikapika13
> ------------------------------------------------------------------------
> pikapika13's Profile:
http://www.excelforum.com/member.php...o&userid=10892
> View this thread: http://www.excelforum.com/showthread...hreadid=557898
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks