Hi I am struggling with the code for a command button to update from a userform to my worksheet. I have just started using VBA and the internet is my source for learning.
When I try and update the field on user form with text for example "N/A" I get run time error 13
It will however update the worksheet cell with dates but I want the userform to update the worksheet with dates and text when necessary or just leave the cell empty .
This is where I am at currently
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
Display More
I would be grateful for any help on this
Regards Bob