Hello kind community!
I have a userform which contains a textbox for the user to enter a date. I have it so that current day's date automatically populates in the textbox. Then when a command button is clicked, a new row is added with the date in the spreadsheet.
The formatting is correct as I want it ("mm/dd/yyyy"); however when I press "Cntrl + `" I can see that the data appears to be as a string, instead of the numerical values.
My truncated code is as follows:
-------------------------------------------
Private Sub UserForm_Initialize()
With Data_GUI.date1
Me.date1.Value = Format(Now(), "Short Date")
End With
End Sub
--------------------------------------------
Private Sub loadbutton_Click()
Dim NextRow As Long
NextRow = Application.WorksheetFunction.CountA(Range("$A$3:$A$100000")) + 1
Sheets("TEST").Range("Data_Start").Offset(NextRow + 1, 0).Value = date1
MsgBox "Data Successfully Added!", 0, "Complete"
Call resetForm
End Sub
--------------------------------------------
To my understanding, UserForm textboxes appear as a string format; so I may need to do an AfterUpdate format change? Perhaps with Cdate function?
Can someone help me with this? I apologize if this has been answered already. I've searched fairly hard on this forum and other online sources and have not been able to figure it out.
Any help here is greatly appreciated.
Thank you!
I have a userform which contains a textbox for the user to enter a date. I have it so that current day's date automatically populates in the textbox. Then when a command button is clicked, a new row is added with the date in the spreadsheet.
The formatting is correct as I want it ("mm/dd/yyyy"); however when I press "Cntrl + `" I can see that the data appears to be as a string, instead of the numerical values.
My truncated code is as follows:
-------------------------------------------
Private Sub UserForm_Initialize()
With Data_GUI.date1
Me.date1.Value = Format(Now(), "Short Date")
End With
End Sub
--------------------------------------------
Private Sub loadbutton_Click()
Dim NextRow As Long
NextRow = Application.WorksheetFunction.CountA(Range("$A$3:$A$100000")) + 1
Sheets("TEST").Range("Data_Start").Offset(NextRow + 1, 0).Value = date1
MsgBox "Data Successfully Added!", 0, "Complete"
Call resetForm
End Sub
--------------------------------------------
To my understanding, UserForm textboxes appear as a string format; so I may need to do an AfterUpdate format change? Perhaps with Cdate function?
Can someone help me with this? I apologize if this has been answered already. I've searched fairly hard on this forum and other online sources and have not been able to figure it out.
Any help here is greatly appreciated.
Thank you!