+ Reply to Thread
Results 1 to 8 of 8

Cell choice, then run function

  1. #1
    Registered User
    Join Date
    03-04-2005
    Posts
    24

    Cell choice, then run function

    Hi There,

    Need your help please.
    I need to be able to run some vba code every time a choice is made from a dropdown.
    Is that doable?

    Best Regards,

    Steve.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Cell choice, then run function

    Hi SteveW,

    Yep, that is doable. Your code goes behind the sheet that has the dropdown on it. You then write "Event" code that checks if that cell changes and if it does, then the macro is triggered.

    Example: If you are checking a dropdown in cell B5 then the code looks like this:
    Please Login or Register  to view this content.
    Search the net for more examples of Event code like: https://www.thesmallman.com/vba-worksheet-change-events
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    03-04-2005
    Posts
    24

    Re: Cell choice, then run function

    Hi Marvin,

    Thanks for the post.
    That looks good.
    I have an issue though as the dropdown is in every cell of the column.
    I have a sheet of phone numbers and after the phone call I mark the call with a value from the dropdown on the same row.
    Can a function be called when I do not know what cell the dropdown is in?

    Thanks for the help.

    Best Regards,

    Steve.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Cell choice, then run function

    Hey Steve,

    Instead of checking for a single cell like Cells(5,"B") you check for the entire column "Columns("B")" to fire YourMacro. NOW the "Target" can be passed to the macro and you can pick off which row that target was on, using Target.Row .

    See the example and change anything in column B.

    VBA Passing Parm to other Sub.xlsm

  5. #5
    Registered User
    Join Date
    03-04-2005
    Posts
    24

    Re: Cell choice, then run function

    Hi Marvin,

    Perfect, Thank You.

    And thanks for the demo, I appreciate it.

    Best Regards,

    Steve.

  6. #6
    Registered User
    Join Date
    03-04-2005
    Posts
    24

    Re: Cell choice, then run function

    Hi There,

    Due to the help I have received I am making good progress with this but …
    I have a few gotcha's. I only want to call the function if the cell is originally blank because I do not want to it to count if I have already chosen an outcome from the dropdown.
    Is there a way to check that the cells original value is blank and then call the function?

    Thanks for the help.

    Best Regards,

    Steve.

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Cell choice, then run function

    Hi Steve,

    Something like this?
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-04-2005
    Posts
    24

    Re: Cell choice, then run function

    Hi Marvin,

    Thanks for the quick reply.
    It's not quite right so I think I have not explained correctly by me. Sorry.

    In the dropdown I have 4 values and one of them is picked as the status/result of the telephone call that was just made. So if I select "No Interest" I do not want to be able to select a different out come later.
    The cell is originally blank so when I first select the dropdown I would like to know the value was originally blank and not "No Interest".

    Hope that makes sense.

    Best Regards,

    Steve.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Multiple Time Stamps depending on choice in Drop Down List Choice
    By insayah in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-25-2022, 09:53 AM
  2. [SOLVED] if function with three choice
    By mazan2010 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-28-2017, 09:59 PM
  3. Make an multiple choice quiz with randomized choice
    By shaterroi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-16-2015, 11:04 AM
  4. Replies: 3
    Last Post: 12-09-2013, 04:21 AM
  5. Drop Down Box Choice Selects Volume Function
    By Tony Pass in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-29-2013, 01:40 AM
  6. Dtaa validation as a choice in a IF function
    By sirenwerks in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-26-2013, 11:51 AM
  7. Replies: 2
    Last Post: 07-10-2012, 04:37 PM

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