Skip Bisconer
Active Member
- Joined
- Jun 14, 2002
- Messages
- 263
I have nine lines that may or may not have numbers in them. When the user finishes entries the vba updates the lines entered into a printable form. I am using the following statement with the line numbers and txtnames changed for each available line.
' Update line one on quote form.
Sheet1.Select
With Selection
Range("A16") = txtQty1
Range("B16") = ComboBox1
Range("C16") = txtOrigin1
Range("G16") = txtDest1
Range("J16") = txtCost1
If txtQty1 <> "" Then
Range("K16") = txtQty1 * txtCost1
End If
This works great if txtQty1 is left blank however if txtCost1 is left blank the procedure errors out. Is there a way in an If Then statement to say If txtQty1 or txtCost1 is not blank then Range("K16") = txtQty1 * txtCost1?
' Update line one on quote form.
Sheet1.Select
With Selection
Range("A16") = txtQty1
Range("B16") = ComboBox1
Range("C16") = txtOrigin1
Range("G16") = txtDest1
Range("J16") = txtCost1
If txtQty1 <> "" Then
Range("K16") = txtQty1 * txtCost1
End If
This works great if txtQty1 is left blank however if txtCost1 is left blank the procedure errors out. Is there a way in an If Then statement to say If txtQty1 or txtCost1 is not blank then Range("K16") = txtQty1 * txtCost1?