+ Reply to Thread
Results 1 to 9 of 9

set datepicker value to current date on workbook open

Hybrid View

  1. #1
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,056

    Re: set datepicker value to current date on workbook open

    I can't seem to find an initialize event if the date picker is on the worksheet. There may be a work-around. Click the 'Developer' tab and then in the 'Controls' group click 'Design Mode'. Right click the date picker and click 'View Code'. Paste this macro into the window:
    Private Sub DTPicker21_GotFocus()
        DTPicker21.Value = Date
    End Sub
    Return to your sheet and click 'Design Mode' to turn it off. When you click on the date picker, it will automatically display today's date. I'm not sure if this works for you. There may be a better solution.
    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.

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

    Re: set datepicker value to current date on workbook open

    Here is another approach. Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet.
    Private Sub Worksheet_Activate()
        DTPicker21.Value = Date
    End Sub
    The date will default to today every time you select the worksheet.

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

    Re: set datepicker value to current date on workbook open

    Another approach still that meets your original request:
    Private Sub Workbook_Open()
        Sheets("Sheet1").DTPicker21.Value = Date
    End Sub
    Put it in the workbook_open. Change "Sheet1" to suit your needs. Save and close the file. Open the file.

  4. #4
    Registered User
    Join Date
    11-11-2014
    Location
    Cheltenham, England
    MS-Off Ver
    2010
    Posts
    19

    Re: set datepicker value to current date on workbook open

    Resource Trial.xlsm


    Thanks for your responses Mumps1. It feels like the last option should work but it isnt I have attached the file to see if this helps make any sense.

    Cheers

+ 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. Open a workbook off my desktop then closing current workbook
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2013, 03:34 PM
  2. Excel Log: VBA to Add Row(s) Upon Workbook Open Last through Current Date
    By jdppep in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2013, 04:22 PM
  3. Open workbook, copy rows, paste to end of current workbook
    By gmn734 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2013, 05:16 AM
  4. [SOLVED] VBA to Open File (filename contains current date) & copy Sheet to active workbook
    By jlstidham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2013, 10:50 PM
  5. How to open,save and close another workbook from the current workbook using macro?
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2012, 10:42 AM

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