View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Steve[_9_] Steve[_9_] is offline
external usenet poster
 
Posts: 32
Default date format problem??

Hi there, hope you can help with this,,,
am using the code below with few problems,

the following line is showing in my spreadsheet as "TRUE" rather than
the date that gets entered

ws.Cells(iRow, 2).Value = Me.TextBox2.Value = Format(Date, "dd/mm/yy")

any help would be appreciated


Steve


Private Sub cmdadd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Lesson1")

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

If Trim(Me.TextBox1.Value) = "" Then
Me.TextBox1.SetFocus
MsgBox "Please enter an Amount"
Exit Sub
End If

ws.Cells(iRow, 1).Value = Me.TextBox1.Value
ws.Cells(iRow, 2).Value = Me.TextBox2.Value = Format(Date, "dd/mm/yy")
ws.Cells(iRow, 3).Value = Me.TextBox3.Value
ws.Cells(iRow, 5).Value = Me.TextBox4.Value
ws.Cells(iRow, 6).Value = Me.TextBox5.Value


Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
Me.TextBox5.Value = ""
Me.TextBox1.SetFocus
Unload Me
End Sub