+ Reply to Thread
Results 1 to 6 of 6

Problem with Lookup-function

  1. #1
    SamMy
    Guest

    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?

  2. #2
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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?




  3. #3
    SamMy
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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?

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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?

    > >
    > >
    > >




  5. #5
    SamMy
    Guest

    Re: Problem with Lookup-function

    Now I got it (thank god it's friday ).

    Thank You!

  6. #6
    Bob Phillips
    Guest

    Re: Problem with Lookup-function

    No argument the <G>

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "SamMy" <[email protected]> wrote in message
    news:[email protected]...
    > Now I got it (thank god it's friday ).
    >
    > Thank You!




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1