so on the back of that also..
Private Sub cmdCancel_Click() Unload Me
End Sub
Private Sub cmdClear_Click()
' Clear the form
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
End Sub
Private Sub cmdOK_Click()
Dim RowCount As Long
Dim ctl As Control
' Check user input
If Me.cbohandler.Value = "" Then
MsgBox "Please enter YOUR Name.", vbExclamation, "Handler missing"
Me.cbohandler.SetFocus
Exit Sub
End If
If Me.cbohandler.Value = "" Then
MsgBox "Please enter your TEAM's Name.", vbExclamation, "Handler missing"
Me.cbohandler.SetFocus
Exit Sub
End If
If Me.txtDOL.Value = "" Then
MsgBox "Please enter a Date of Loss.", vbExclamation, "Date of Loss Missing"
Me.txtDOL.SetFocus
Exit Sub
End If
If Me.txtDOR.Value = "" Then
MsgBox "Please enter date of review.", vbExclamation, "Date of Review missing"
Me.txtDOR.SetFocus
Exit Sub
End If
If Me.cbocontact.Value = "" Then
MsgBox "Please enter who contact was with.", vbExclamation, "Contact Missing"
Me.cbocontact.SetFocus
Exit Sub
End If
If Me.cbomethod.Value = "" Then
MsgBox "Please enter method of contact.", vbExclamation, "Contact Method Missing"
Me.cbomethod.SetFocus
Exit Sub
End If
' Write data to worksheet
RowCount = Worksheets("comms").Range("B7").CurrentRegion.Rows.Count
With Worksheets("comms").Range("B7")
.Offset(RowCount, 0).Value = Me.cbohandler.Value
.Offset(RowCount, 1).Value = Me.cboteamname.Value
.Offset(RowCount, 2).Value = Format(CDate(Me.txtweekc.Value), "dd/mm/yyyy")
.Offset(RowCount, 3).Value = Me.txtClaim.Value
.Offset(RowCount, 4).Value = Format(CDate(Me.txtDOL.Value), "dd/mm/yyyy")
.Offset(RowCount, 5).Value = Format(CDate(Me.txtDOR.Value), "dd/mm/yyyy")
.Offset(RowCount, 6).Value = Me.cbocontact.Value
.Offset(RowCount, 7).Value = Me.cbomethod.Value
.Offset(RowCount, 8).Value = txtreason.Value
End With
' Clear the form
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
ctl.Value = ""
ElseIf TypeName(ctl) = "CheckBox" Then
ctl.Value = False
End If
Next ctl
ThisWorkbook.Save
End Sub
Private Sub txtweekc_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'check date format
With txtweekc
If IsDate(.Text) Then 'Format as desired.
.Text = Format(CDate(.Text), "dd/mm/yyyy")
Else
.Text = "" 'Clear the TextBox
MsgBox "Please enter a valid date."
Cancel = True
Exit Sub
End If
'Test for date in correct range
If CDate(.Text) > Now + 30 Then 'Sooner that 30 days in future, adjust as needed
.Text = ""
MsgBox "Please enter a valid date."
Cancel = True
End If
End With
End Sub
Is there ANY reason in the above code why the dates are pulling back onto the worksheet as USA dates? (i know i'm missing 2 date fields with the validation but i test everytime i add a piece of code and for some reason this is pulling through US dates)