+ Reply to Thread
Results 1 to 4 of 4

vba calendar not populating the correct date format

  1. #1
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    vba calendar not populating the correct date format

    Hi, inside the attached file is a calendar that pops up when you click inside the textbox "Prepared date". This date goes into cell C2 after execution in the format dd/mm/yyyy. It works fine, only for dates greater than the 12th of each month. Any date smaller than that and the date format in cell C2 changes to mm/dd/yyyy. Does anyone know how to fix this?
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: vba calendar not populating the correct date format

    You password protected your code modules.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: vba calendar not populating the correct date format

    When writing the date to the worksheet, use the CDate function to convert the TextBox's text-date to a serial-date based on your regional setting.

    ActiveCell.Value = CDate(TextBox1.Value)

  4. #4
    Forum Contributor
    Join Date
    05-06-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    361

    Re: vba calendar not populating the correct date format

    Thank you AlphaFrog for the help, and sorry for the password locked file

+ 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] How to correct date format
    By Droriley in forum Excel General
    Replies: 5
    Last Post: 05-15-2015, 05:10 AM
  2. Replies: 0
    Last Post: 02-21-2013, 09:04 AM
  3. [SOLVED] Auto Populating Info from cells to a calendar by date
    By mitchellm203 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-30-2012, 08:36 PM
  4. Error when populating active cell with date from calendar in user form
    By jwala in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2010, 03:02 AM
  5. Replies: 3
    Last Post: 10-28-2010, 07:04 AM
  6. Replies: 1
    Last Post: 06-11-2010, 07:36 AM
  7. How do I correct date format?
    By Chris in forum Excel General
    Replies: 1
    Last Post: 06-07-2006, 02:50 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