+ Reply to Thread
Results 1 to 6 of 6

Event Change Question

  1. #1
    Forum Contributor
    Join Date
    06-21-2004
    Posts
    106

    Event Change Question

    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!

  2. #2
    Bob Phillips
    Guest

    Re: Event Change Question

    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
    >




  3. #3
    Forum Contributor
    Join Date
    06-21-2004
    Posts
    106
    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"

  4. #4
    Bob Phillips
    Guest

    Re: Event Change Question

    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
    >




  5. #5
    Forum Contributor
    Join Date
    06-21-2004
    Posts
    106
    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.

  6. #6
    Bob Phillips
    Guest

    Re: Event Change Question

    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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1