Hi I am trying to create a user sheet that updates the dates or the information in a column of a Worksheet. I have a code that allows me to change and update in uk date format, but if i want to leave the cell blank or add Text I get an error message and the userform will not update the worksheet. I have just started using VBA and I cant workout a code to allow me to add both date & text. This is my code so far would be grateful for any advice.
Regards Bob
VBA Code:
Private Sub CommandButton1_Click()
Dim i As Long, LastRow As Long
Set sh = ThisWorkbook.Sheets("Mandatory")
LastRow = Sheets("Mandatory").Range("A" & Rows.Count).End(xlUp).Row
For i = 4 To LastRow
If Sheets("Mandatory").Cells(i, 1).Value = (Me.ComboBox3) Or _
Sheets("Mandatory").Cells(i, 1).Value = Val(Me.ComboBox3) Then
Sheets("Mandatory").Cells(i, 5) = CDate(TextBox4.Value)
End If
Next i
End Sub
Regards Bob