S
Steen
Hi
I have got a problem with writing some date back from a form to excell
sheet, which I hope someone can help med with.
The problem is that the date entered in the form - shifts date and month in
the resulting date that is written into the cell in excell and I can't figure
out why? See comment in the below code ('Result)
I have a form which have a date that is initialized&activated by a
dubbelclick on the row:
Sheet1:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Select Case Target.Column
Case 1
'initialize Tasklist form
frmTaskList.txtDeadline.Value = Format(Target.Offset(0, 13),
"dd-mm-yyyy")
'Call Tasklist form
frmTaskList.Show
End Select
End If
End Sub
Private Sub cmdAccept_Click()
If Me.txtDeadline.Value = "" Then
MsgBox "Please enter Deadline.", vbExclamation, "Task Values"
Me.txtDeadline.SetFocus
Exit Sub
End If
If Not IsDate(Me.txtDeadline.Value) Then
MsgBox Me.txtDeadline.Value
MsgBox "Please enter Deadline.", vbExclamation, "Task Values"
Me.txtDeadline.SetFocus
Exit Sub
End If
RowNo = ActiveCell.Row - 1
With Worksheets("Tasklist").Range("A1")
MsgBox (Format(Me.txtDeadline.Value, "dd-mm-yyyy")) 'Result:
06-04-2009
.Offset(RowNo, 13).Value = Me.txtDeadline.Value
MsgBox (Format(.Offset(RowNo, 13).Value, "dd-mm-yyyy")) 'Result:
04-06-2009
End With
Unload Me
End Sub
Any help would be much appriciated.
/Steen
I have got a problem with writing some date back from a form to excell
sheet, which I hope someone can help med with.
The problem is that the date entered in the form - shifts date and month in
the resulting date that is written into the cell in excell and I can't figure
out why? See comment in the below code ('Result)
I have a form which have a date that is initialized&activated by a
dubbelclick on the row:
Sheet1:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Select Case Target.Column
Case 1
'initialize Tasklist form
frmTaskList.txtDeadline.Value = Format(Target.Offset(0, 13),
"dd-mm-yyyy")
'Call Tasklist form
frmTaskList.Show
End Select
End If
End Sub
Private Sub cmdAccept_Click()
If Me.txtDeadline.Value = "" Then
MsgBox "Please enter Deadline.", vbExclamation, "Task Values"
Me.txtDeadline.SetFocus
Exit Sub
End If
If Not IsDate(Me.txtDeadline.Value) Then
MsgBox Me.txtDeadline.Value
MsgBox "Please enter Deadline.", vbExclamation, "Task Values"
Me.txtDeadline.SetFocus
Exit Sub
End If
RowNo = ActiveCell.Row - 1
With Worksheets("Tasklist").Range("A1")
MsgBox (Format(Me.txtDeadline.Value, "dd-mm-yyyy")) 'Result:
06-04-2009
.Offset(RowNo, 13).Value = Me.txtDeadline.Value
MsgBox (Format(.Offset(RowNo, 13).Value, "dd-mm-yyyy")) 'Result:
04-06-2009
End With
Unload Me
End Sub
Any help would be much appriciated.
/Steen