Results 1 to 6 of 6

Date format changes in Userform Textbox output

Threaded View

  1. #1
    Registered User
    Join Date
    12-29-2024
    Location
    Melbourne Australia
    MS-Off Ver
    16
    Posts
    4

    Date format changes in Userform Textbox output

    Hi all,
    I have a userform which is use to add data to a worksheet. Textbox1 is for the date which I would like to be dd/mm/yyyy. I have a Command button to show todays date:

    Private Sub CommandButton2_Click()
    TextBox1 = Date

    End Sub

    The date appears in Textbox1 as mm/dd/yyyy......but the output to the worksheet is dd/mm/yyyy

    If I manually enter the date in Textbox1 in my preferred format (dd/mmm/yyyy) the output to the worksheet is mm/dd/yyyy

    Is there a way of having Textbox1 AND the output in dd/mm/yyyy format

    This is the code I use to populate the worksheet:

    Private Sub CommandButton1_Click()
    activesheet.Select
    Dim LastRow As Object

    Set LastRow = activesheet.Range("a65536").End(xlUp)

    LastRow.Offset(1, 0).Value = TextBox1.Value
    LastRow.Offset(1, 1).Value = TextBox2.Text
    LastRow.Offset(1, 2).Value = TextBox3.Text
    LastRow.Offset(1, 3).Value = TextBox4.Text
    LastRow.Offset(1, 4).Value = ComboBox2.Value
    LastRow.Offset(1, 5).Value = ComboBox1.Text


    MsgBox " Transaction added"

    response = MsgBox(" Do you want to add another transaction?", _
    vbYesNo)

    If response = vbYes Then
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    TextBox4.Text = ""
    ComboBox2.Text = ""
    ComboBox1.Text = ""

    TextBox1.SetFocus

    Else
    Unload Me
    End If

    End Sub

    Thanks in advance....
    Last edited by BruceWat; 01-06-2025 at 07:26 PM. Reason: spelling

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Date format for userform (textbox)
    By jp16 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-22-2018, 12:42 PM
  2. [SOLVED] Date Format in Userform Textbox
    By alteredbeast in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-10-2017, 03:58 AM
  3. [SOLVED] Date format in textbox userform
    By Crispy85 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2016, 06:57 AM
  4. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  5. [SOLVED] Excel 2007, Userform Textbox Date Format and Calendar Control Userform
    By riffology in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2014, 06:18 PM
  6. Date Format for textbox in userform
    By processchip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2011, 06:42 AM
  7. Wrong Date Format in output userform
    By ABBOV in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2010, 06:58 AM

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