I'm using a UserForm for all of this - with textboxes for
everything. I tried using a sub routine for on the change event, but
that gives me an error when the qty is added for the first time without
a barcode to fill in the Unit Price.
I have 8 lines on my invoice - I would like to have them added
dynamically, however, I am unsure how to do that. This is the code for
my first line in the invoice. The remaining lines are 2 - 8. I tried
using Application.Volatile (True), but that doesn't seem to change
anything.
Private Sub txtBarCode1_AfterUpdate()
Application.Volatile (True)
If IsNumeric(txtBarCode1) Then
Desc1.Text = Application.VLookup(Val(txtBarCode1.Text), _
Worksheets("Product List").Range("A:E"), 3, 0)
intUP1.Text = Format(Application.VLookup(Val(txtBarCode1.Text), _
Worksheets("Product List").Range("A:E"), 4, 0), "#,##0.00")
intTotal1.Text =
Format(Application.WorksheetFunction.Product(intQTY1, intUP1),
"#,##0.00")
txtBarCode2.SetFocus
Else
Desc1.Text = Application.VLookup(txtBarCode1.Text, _
Worksheets("Product List").Range("A:E"), 3, 0)
intUP1.Text = Format(Application.VLookup(txtBarCode1.Text, _
Worksheets("Product List").Range("A:E"), 4, 0), "#,##0.00")
intTotal1.Text =
Format(Application.WorksheetFunction.Product(intQTY1, intUP1),
"#,##0.00")
txtBarCode2.SetFocus
End If
If IsNull(intTotal1) Then
intQTY2 = ""
Else
intQTY2 = "1"
End If
Call RunningTotal
End Sub