View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MJ Antoszkiw MJ Antoszkiw is offline
external usenet poster
 
Posts: 2
Default VBA - VLOOKUP Sub

Hi,
When a user click a button, I want to perform a VLOOKUP.
However, when the user clicks this button, the formula is
entered correctly, apart from '' around column names, i.e.
B9 becomes 'B9' - this stops the formula from functioning
correctly.

How can I stop it doing this? Heres my code..
Sub getDesc(strLookup_value, strTable_array,
intIndex_column)

Range("E8").FormulaR1C1 = _
"=VLOOKUP(" & strLookup_value & "," &
strTable_array & "," & intIndex_column & ")"

End Sub

Sub getDesc_Sys()
Call getDesc("Temp!B9", "HardwareData!A8:Q11", "16")
End Sub
Note: I've made a sub to get the desc, because once the
first one will work, i can do many more but just using one
line of code and calling the first sub with my own values.

Can anyone help?
Thanks.
MJ Anotszkiw