Trying to sub a variable into vlookup for the table array.
This works:
This doesn't:
"Application-defined or object-defined error"
I guess that means that's not how you call a variable in this format. I need to use the second version, how do you do it?
This works:
Code:
Sub vl()
' temporary fix for summer teach
Dim vl1 As Range
Dim vl2 As Range
Dim vl1a As Range
Set vl1 = Range("A:A").Find("C.I.")
Set vl2 = Range("B:B").Find("17200")
Set vl1a = Range(vl1, vl2)
MsgBox vl1a.Address
ActiveCell.Formula = "=VLOOKUP(G5," & vl1a.Address & ",2)*H5"
End Sub
This doesn't:
Code:
Sub vl()
' temporary fix for summer teach
Dim vl1 As Range
Dim vl2 As Range
Dim vl1a As Range
Set vl1 = Range("A:A").Find("C.I.")
Set vl2 = Range("B:B").Find("17200")
Set vl1a = Range(vl1, vl2)
MsgBox vl1a.Address
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2]," & vl1a.Address & ",2)*RC[-1]"
End Sub
"Application-defined or object-defined error"
I guess that means that's not how you call a variable in this format. I need to use the second version, how do you do it?