SOLVED see reply. I use a user form to fill in an invoice, the form consists of a drop down box for part numbers, a part description, labour price, retail price and qty sold
I get a runtime error 1004 Application-defined or object defined error when the ok button is pressed and the Txt Box Qty is empty
I use the attached code to fill in the invoice sheet from the user form when the ok button is clicked
Private Sub CmdOK_Click()
Dim R As Range
Dim TbxQty As Long
Set R = Sheets("Client Invoice").Range("A19:A36").End(xlUp)
ActiveCell.Value = Me.CbxPartNo.Value
ActiveCell.Offset(0, 1).Value = Me.Tbxdescription.Value
ActiveCell.Offset(0, 10).Value = Me.TbxQty.Value
ActiveCell.Offset(0, 11).Value = Me.TbxLabour.Value
ActiveCell.Offset(0, 12).Value = Me.TbxRetail.Value
'Reduce Inventory when item sold
Sheets("Full Price List").Range("C" & CbxPartNo.ListIndex + 1).Value = Sheets("Full Price List").Range("C" & CbxPartNo.ListIndex + 1).Value - Me.TbxQty.Value
'Add Qty to Qty Sold column
Sheets("Full Price List").Range("I" & CbxPartNo.ListIndex + 1).Value = Sheets("Full Price List").Range("I" & CbxPartNo.ListIndex + 1).Value + Me.TbxQty.Value
Unload Me
msgboxyesno
End Sub
Bookmarks