I have 4 text boxes which may or may not have a numeric value entered. It needs to be a minus so I have formatted as CDbl() as it is numeric
Code works fine if a number is put in every box but fails if one is left empty. I have tried using an If statement
If Txt1.value = 0 Then
Range("B5").Value = 0
Else
Range("B5").Value = CDbl(Txt1.Value)*-1
End If
If Txt2.Value = 0 Then
Range("C5"").Value = 0
Else
Range("C5").Value = CDbl(Txt2.Value)*-1
End If
I have also tried Txt1.Value = " " and IsNull(Txt1.Value).
All to no avail so how can I get the code to work with random empty text boxes (putting a default of 0 in the text box in makes the form look clumsy.)
Bookmarks