Dear Expert,
I am not good in VBA but I tried the code below so far it works somehow
except the Vlookup Value that Meal 8 = 40.5 and Meal 3 =25.6
1. how can fix the code to have the correct value
2. how can I improve my Code if Quantity Oder increase should (Order Quantity x Amount)
Ex. Meal 6 Order Qty 2 Amount = 59.26
Sub myVLookUp()
'test vlookup
Range("M5").Select
Range(Selection, Selection).End(xlDown).Offset(0, 1).Select
Range(Selection, Selection).End(xlUp).Offset(1, 0).Value = "Meal 3"
Range(Selection, Selection).End(xlUp).Offset(0, 1).Value = 1
Range(Selection, Selection).End(xlUp).Offset(0, 2).Select
Dim lkvalue As Range
Dim tblArr As Range
Set lkvalue = Range("N6:N1000")
Set tblArr = Range("U6:V1000")
ActiveCell = Application.WorksheetFunction.VLookup(lkvalue, tblArr, 2, False)
Range(Selection, Selection).End(xlToLeft).Offset(0, 1).Select
End Sub
Thank you in advance your help,
12Rev79
I am not good in VBA but I tried the code below so far it works somehow
except the Vlookup Value that Meal 8 = 40.5 and Meal 3 =25.6
1. how can fix the code to have the correct value
2. how can I improve my Code if Quantity Oder increase should (Order Quantity x Amount)
Ex. Meal 6 Order Qty 2 Amount = 59.26
Sub myVLookUp()
'test vlookup
Range("M5").Select
Range(Selection, Selection).End(xlDown).Offset(0, 1).Select
Range(Selection, Selection).End(xlUp).Offset(1, 0).Value = "Meal 3"
Range(Selection, Selection).End(xlUp).Offset(0, 1).Value = 1
Range(Selection, Selection).End(xlUp).Offset(0, 2).Select
Dim lkvalue As Range
Dim tblArr As Range
Set lkvalue = Range("N6:N1000")
Set tblArr = Range("U6:V1000")
ActiveCell = Application.WorksheetFunction.VLookup(lkvalue, tblArr, 2, False)
Range(Selection, Selection).End(xlToLeft).Offset(0, 1).Select
End Sub
Thank you in advance your help,
12Rev79