+ Reply to Thread
Results 1 to 17 of 17

Autorun of macro based on cell value

  1. #1
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Autorun of macro based on cell value

    Hi Team,

    Need help with the below scenario

    I have a datavalidation done on cell A1 and the datavalidation list has 3 different criteria and have if condition for each criteria

    Now when the user selects Criteria 1 from the data validation list, Macro 1 should run, and then when he changes to criteria 2 macro 2 should run.

    Please help.

    Regards,
    Naveen

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    Paste code in Sheet Module that houses A1 Data Validation...

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    HI, thanks for the quick response.

    I pasted the code in the sheet and the macro for each scenario in module.. but when the cell value is changed, macro is not working (meaning its not calling the macro in module)

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    Then...Something wrong doing you are...
    Post your sample file

    You have changed "Crit 1" etc to your data validation drop down text...Right?

  5. #5
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    HI, since am using my office laptop am not able to upload the same file. it throws error

    yes i changed the name of criteria 1 macro 1 and all jus i need is when criteria 1 is selected, from sheet2s row 2 to 10 should be pasted in sheet 1
    when criteria 2 is selected rw 11 to 20 is to be pasted in sheet 1

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    Works on my side...

  7. #7
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    very sorry. due to company policy there are restrictions tat even we cant make an attachment for external mail id's

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    very sorry
    No need to be...doesn't affect me
    See sample upload...To see if you can figure it out...
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    HI THanks, but when i selected criteria 1 or criteria 2 am not getting the msgbox.. Am i missing some setting here.. i am just selecting from the dropdown list

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    Like I said...Works my side...
    Crit 2.png

  11. #11
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    still not working.. Should i need to change any settings or any?

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    Is my sample file not working on your pc...
    Have no idea what your scenario is...
    Have you enabled macros?

  13. #13
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    yes macro are enabled. and if i run the module separately i get the msgbox...

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    Sorry no idea?

  15. #15
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    oops ok let me try any other thing if it works.. if i run the module am getting the msgbox only when cell value is changed its not poped up

  16. #16
    Registered User
    Join Date
    03-10-2014
    Location
    Chennai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Autorun of macro based on cell value

    HI Sintek,

    I went to trust center and changed the setting and restarted the sytem and now its working superb.. thanks for your help and support.

    regards,
    Navi

  17. #17
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,170

    Re: Autorun of macro based on cell value

    Hi Navi

    Glad you got it sorted...Please remember to mark thread as solved...Tx for adding rep +

+ 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. [SOLVED] Autorun macro when cell value is changed
    By moonbreakker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2015, 12:46 AM
  2. Macro autorun on cell change
    By hojkoff in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-26-2011, 11:25 AM
  3. Autorun macro when the cell is changed
    By jesseteh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-21-2009, 09:52 PM
  4. Autorun Macro when formula in cell updates
    By ColinNicol17 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2009, 06:21 PM
  5. When I change a cell a macro will autorun BUT..
    By Infinity in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-31-2006, 12:49 AM
  6. How do get a macro to autorun when i change a cell in the spreadsheet?
    By Infinity in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-27-2006, 07:14 PM
  7. [SOLVED] AutoRun Macro Based on a Sum Calculation
    By Jared J in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2006, 01:30 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