So, I have created a user form to enter data onto a spreadsheet. The problem is....(Please see code below)when the form opens it automatically puts today's date in the "txtDate" box and when the enter key is pressed it loads the date in the desired format onto the spreadsheet. The desired format is dd/mm/yyyy.
If I manually change the date in the user form it reverts back and enters on the sheet as mm/dd/yyyy
However I don't want to use the "Today()" what I have been trying (many, many ways) is to leave the date box clear on the user form and manually enter the date (dd/mm/yyyy) in the user form and to, when the enter button is pressed to have it transferred to the spreadsheet in the same format.
Private Sub btnCancel_Click() Unload Me End Sub Private Sub btnInput_Click() Dim ws As Worksheet Set ws = Worksheets("Appointments") Dim newRow As Long newRow = Application.WorksheetFunction.CountA(ws.Range("B:B")) + 1 ws.Cells(newRow, 2).Value = Me.txtDate.Value ws.Cells(newRow, 3).Value = Me.txtTime.Value ws.Cells(newRow, 4).Value = Me.txtLocation.Value ws.Cells(newRow, 5).Value = Me.txtDepartment.Value End Sub Private Sub UserForm_Initialize() txtDate.Text = Format(Now(), "dd/mm/yyyy") End Sub
It is the last three lines that is giving me a hair pulling problem (I am now bald).
To learn should be desired, to help is inspiring.
Please 'inspire' me and quench a little of my 'desire'.