Problem with Lookup-function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sub test()
Cells(3, 3).FormulaR1C1 = "=sum(R1C1:R5C1)" 'Succees
Cells(4, 3).Value = "LOOKUP(3;R1C2:R5C2;R1C1:R5C1)" 'Succees
Cells(2, 3).FormulaR1C1 = "=LOOKUP(3;R1C2:R5C2;R1C1:R5C1)" 'Error
End Sub

VBA in Excel 2002. Two first lines succees, but the third one gives error
'Runtime error 1004: Application or object defined error'. What's wrong with
the third row?
 
The second only works because you have an error, no leadiung = <vbg>

Sub test()
Cells(3, 3).FormulaR1C1 = "=sum(R1C1:R5C1)" 'Succees
Cells(4, 3).Value = "=LOOKUP(3,R1C2:R5C2,R1C1:R5C1)" 'Succees
Cells(2, 3).FormulaR1C1 = "=LOOKUP(3,R1C2:R5C2,R1C1:R5C1)" 'Error
End Sub



--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
I did, no leading =.

I also gave you corrected code. As I understand, in VBA you use commas
regardless of your settings, Excel will transform it.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
No argument the <G>

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top