Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Error using the MATCH worksheet function

  1. #1
    New Member
    Join Date
    Feb 2002
    Location
    Texas Instruments
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I get an error when I try to use MATCH from the immediate window:

    ?Application.WorksheetFunction.Match(0.2,A1:A10,1) A1:A10 contains a sequential range of numbers from -.2 to 0.5 . I get a compile error "Expected list separator or )". From Excel help, this seems to be the correct syntax. What am I missing?

  2. #2
    New Member
    Join Date
    Feb 2002
    Location
    Texas Instruments
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    It seems that the help examples only work on a spreadsheet, not from VBA. VBA requires a range.This works:

    ?Application.WorksheetFunction.Match(0.2,Worksheets("Sheet1").range("A1:A10"),1)
    5

  3. #3
    Guest

    Default

    Change that to

    Application.Match(0.2,Range("A1:A10"),1)

    It's a little more reliable than using the WorksheetFunction

  4. #4
    Board Regular
    Join Date
    May 2002
    Posts
    541
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You can also fix the problem by changing your quotations to brackets:

    Application.Match(0.2, [A1:B10], 0)

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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