+ Reply to Thread
Results 1 to 9 of 9

Run a macro when date picker chages

  1. #1
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Run a macro when date picker chages

    I would like to run a specific macro to highlight a row when i change the date from a DatePicker ActiveX control.
    That is, I have a macro that works if i change a date in a cell myself. I have now added the DatePicker to select dates from a calendar which i have linked to that same cell.
    When i change the date in the DatePicker, the macro fails to run.

    Please Login or Register  to view this content.
    Range("SearchDay") refers to the cell containing the date which is successfully populated by the DatePicker ActiveX control
    FindSelectedDate is the macro i want to run
    DatePicker is the name of the DatePicker ActiveX control

    Any suggestions?

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Run a macro when date picker chages

    Unfortunately, a Worksheet_Change event is triggered only if a change is made manually to a cell.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Run a macro when date picker chages

    Unfortunately, a Worksheet_Change event is triggered only if a change is made manually to a cell. There is an alternate to using a DatePicker ActiveX control. Have a look at the attached file. If you click A1, a calendar will pop up and a message will be displayed. The worksheet code module has two event macros, one to display the calendar and one to generate the message once you pick a date. Instead of displaying the message you can call your macro.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Re: Run a macro when date picker chages

    Looking very promising. I will test it out to see if it achieves what i need.
    Thank you.

    Works like a charm with little alteration to my own settings.
    Last edited by Crawfy; 01-08-2018 at 01:17 AM.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Run a macro when date picker chages

    You are very welcome.

  6. #6
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Re: Run a macro when date picker chages

    Is there a way to customize the view of the calendar, or the function of it. I would love if i could use arrows to sequentially select the next month along one at a time.

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Run a macro when date picker chages

    I found the code which creates this calendar online some time ago (I wish I could remember where so I could give credit). Changing the functionality would involve changing the code that drives the calendar, which is quite involved. It would be difficult for me to modify it.

  8. #8
    Forum Contributor
    Join Date
    05-28-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    119

    Re: Run a macro when date picker chages

    That's okay. I'll do some searching for alternate forms of calendars.
    I appreciate your help.
    Thanks

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Run a macro when date picker chages

    My pleasure.

+ 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. Setting date picker date and having 2 columns to each date for excel calendar
    By bqheng in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2017, 11:13 PM
  2. [SOLVED] Macro for Date Picker in excel 2013
    By Neilesh Kumar in forum Excel General
    Replies: 14
    Last Post: 05-04-2017, 07:18 AM
  3. Date picker used to populate text box. Date changes back to original value on opening.
    By Stratfordoaks in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-07-2016, 09:42 AM
  4. [SOLVED] file-picker thinks it is a folder-picker if the folder picker runs first?
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-01-2016, 01:14 PM
  5. [SOLVED] PivotTable Conditional Format Chages All Font Color
    By goss in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2014, 08:22 AM
  6. Radical color chages on importing a worksheet (Excel 2010)?
    By djo77399 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-23-2012, 05:07 PM
  7. Macro to do the sum at the last when ever type chages
    By ramse in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2006, 05:50 PM

Tags for this Thread

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