I'm a complete novice with VBA and just need some help getting this code to work. Here is the code
Private Sub cmdGenerateCost_Click()
Dim ws As Worksheet
Set ws = Application.Workbooks(1).Worksheets(2)
Set productsTab = ws.Range("Products")
Application.WorksheetFunction.VLookup
frmAddNewOrder.lblCost.Caption = "Cost: $" & txtQuantity * VLookup(cboProduct, productsTab, 4)
End Sub
However I'm getting an "Argument not optional" error message.
What I need the code to do is for it to calculate the cost of an item using a table from a sheet that has the information, hence the Vlookup, and then change a label in a userform. The table in the sheet is called Products and it is in the 2nd worksheet called, Products. Any help would be greatly appreciated