+ Reply to Thread
Results 1 to 3 of 3

Date formatting problem in Excel vba

  1. #1
    Registered User
    Join Date
    03-25-2004
    Posts
    54

    Date formatting problem in Excel vba

    I have input the current date into column from macro using Date function. This column is formatted as dd/mm/yy.

    I have then tried to input the values from this column into a textbox (txtEnteredOn) on a userform using to force the correct format:

    Private Sub txtEnteredOn_Change()
    txtEnteredOn = Format(txtEnteredOn.Value, "dd/mm/yy")
    End Sub

    However, the date shows as mm/dd/yy format.

    How can I get it to show as dd/mm/yy format?

    Paul

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,446
    Hi,

    have you got the variable dim'd as Date?
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    03-25-2004
    Posts
    54
    Many thanks for suggestion - In the end I found if I added formatting to the value added to the textbox - ie:

    DepmuDetails.txtEnteredOn.Value = Format(EnteredOnDate, "dd/mm/yy")

    it did the trick,

    Paul

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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