Thread: Date format
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Dolphinv4 Dolphinv4 is offline
external usenet poster
 
Posts: 27
Default Date format

Hi,

i created a form whereby user will input a date and on clicking the "OK"
button on the form, this date will be posted into a cell in excel. My problem
is, when it is posted in excel, the cell is not formatted as a date. I need
it to remain as a date so that i can make use of this cell to do other
calculations. Please help. The coding of my userform is as below:

Private Sub cmdOk_Click()

Dim ws As Worksheet
Set ws = Worksheets("FORM IR37")


'copy the data to form IR37
ws.Cells(20, 12).Value = Me.txtDate.Value


'clear the data
Me.txtDate.Value = ""
Me.txtDate.SetFocus

'close the form
Unload Me

End Sub