mercredi 25 février 2015

Excel VBA hlookup function

I am trying to use the excel VBA HLookup function. I have tried it two ways and both produce error. Could anyone explain me what is that I am doing wrong?


First try:



lookupValue = Worksheets(1).Name & "!A1"
tableArray = Worksheets(3).Name & "!$A$1:$" & Col_letter & "$1"
Worksheets("Comparison").Cells(1, 2).Value = "=HLookup(" & lookupValue _
& ";" & tableArray & ";1;FALSE)"


Second try:



tda = Worksheets(1).Cells(1, 1).Value ' I also tried using tda without .Value
Table = Worksheets(3).Range(Cells(1, 1))
Worksheets("Comparison").Cells(1, 2).Value = WorksheetFunction. _
HLookup(tda, Table, 1, False)

Aucun commentaire:

Enregistrer un commentaire