ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with Lookup-function (https://www.excelbanter.com/excel-programming/354990-problem-lookup-function.html)

sammy

Problem with Lookup-function
 
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?

Bob Phillips[_6_]

Problem with Lookup-function
 
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)

"SamMy" wrote in message
...
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?




sammy

Problem with Lookup-function
 
Could you be more specific? No leading - what?

"Bob Phillips" kirjoitti:

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)

"SamMy" wrote in message
...
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?





Bob Phillips[_6_]

Problem with Lookup-function
 
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)

"SamMy" wrote in message
...
Could you be more specific? No leading - what?

"Bob Phillips" kirjoitti:

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)

"SamMy" wrote in message
...
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?







sammy

Problem with Lookup-function
 
Now I got it (thank god it's friday :)).

Thank You!

Bob Phillips[_6_]

Problem with Lookup-function
 
No argument the <G

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"SamMy" wrote in message
...
Now I got it (thank god it's friday :)).

Thank You!





All times are GMT +1. The time now is 09:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com