+ Reply to Thread
Results 1 to 10 of 10

Unable to get the Match property of the WorksheetFunction class

  1. #1
    Registered User
    Join Date
    02-19-2023
    Location
    London
    MS-Off Ver
    2007
    Posts
    27

    Unable to get the Match property of the WorksheetFunction class

    Hello again all,

    Im building a horse racecard analysis tool in excel 2007, using userform. I have a treeview that get todays race courses events and adds them to the parent nodes, and then from the same data file it gets todays races times and uses them as the child nodes for each parent node in the treeview.

    After a lot of jiggery pockery I have this working reasonably well. However, for some weird reason on 5 of the child nodes I am getting no records found, when they are clearly there in my imported csv file.

    Total parent nodes = 8, and there are 6-7 child nodes in each. The problem child nodes are; 2 under one parent, and 1 under each of 3 different parent node... But strangly enough the other child nodes work fine, getting data to set as label text values on child node click event. The problem child nodes return the error above "Unable to get the Match property of the WorksheetFunction class". I dont understand why when it can do it for the other ones.

    I have tried Application.Worksheet.Match / Worksheet.Match / Application.Match, but all return the same error for these specific child nodes. Checking the csv file the race time column (B) is set to custom value hh:mm. As I am retrieving the data from a python web scraper that I haven't written (GitHub) I would prefer to leave the data file as is. Plus its working fine for most of the child nodes so assume the issue is somewhere else.

    I can handle the error within the code but thats not a solution as I need the row of data that is clearly there in the csv file, for this child node click event, but also later when populating a Listview, so trying to figure this out now before proceeding any further.

    Debugging didn't give me much either, stepping through the code I can see the working child nodes get the race course and race time, and get, usually, the first row for a matched race start time, and the code completes as expected. The problem childs however, get the race course and race time, but don't get or match any row numbers, and so the thing breaks. I cant figure why they are not working when it running the same code!

    Also there appears to be no pattern to the child nodes not finding a match. I even created a new web scrape data file and tried that, incase I had messed about with the original, but if anything that has even more child nodes not finding a match, even though the data is there to see. And the sequence of none working child nodes in the treeview using old csv file and updated version (different data) seem to be completely random. Random between the 2 data files but consistent when working on the same file.

    Im lost. Hoping someone has experienceed this before and knows a solution.

    TIA

    I've posted my code to pastebin if anyone want to have a look without downloading the project files https://pastebin.com/LRWFXVfK
    Attached Files Attached Files
    Last edited by BrovashiftExcel; 04-30-2023 at 12:51 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Unable to get the Match property of the WorksheetFunction class

    Please describe in detail the steps to take to reproduce the problem you are having.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Unable to get the Match property of the WorksheetFunction class

    try change that line to
    Please Login or Register  to view this content.
    Seems WorksheetFunction.Match method sometimes doesn't work as Match function in the cell.

  4. #4
    Registered User
    Join Date
    02-19-2023
    Location
    London
    MS-Off Ver
    2007
    Posts
    27
    Quote Originally Posted by 6StringJazzer View Post
    Please describe in detail the steps to take to reproduce the problem you are having.
    Hi,

    Simply load up the project and click through the child nodes in the treeview. I know Exeter 02:25 and 04:10 are causing the error.

  5. #5
    Registered User
    Join Date
    02-19-2023
    Location
    London
    MS-Off Ver
    2007
    Posts
    27
    Quote Originally Posted by jindon View Post
    try change that line to
    Please Login or Register  to view this content.
    Seems WorksheetFunction.Match method sometimes doesn't work as Match function in the cell.
    Hi,

    Thanks for this, will give this a try later. How are you able to tell that the match function isn't working sometimes in a cell, are you seeing something, a value, when debugging... or is it just the fact its not working for some cells/rows?

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Unable to get the Match property of the WorksheetFunction class

    Match function in a cell works, but WorksheetFunction.Match method doesn't for some time value.

    Just test it.

  7. #7
    Registered User
    Join Date
    02-19-2023
    Location
    London
    MS-Off Ver
    2007
    Posts
    27

    Re: Unable to get the Match property of the WorksheetFunction class

    Another idea I had was to try and match by race time only, because I cannot see an issue with the race time column B itself. At present it uses a combination of course name and race time to find/match data, so wondering if I was focusing my attention on the wrong column.

  8. #8
    Registered User
    Join Date
    02-19-2023
    Location
    London
    MS-Off Ver
    2007
    Posts
    27
    Quote Originally Posted by jindon View Post
    Match function in a cell works, but WorksheetFunction.Match method doesn't for some time value.

    Just test it.
    Thanks... will do 👍

  9. #9
    Registered User
    Join Date
    02-19-2023
    Location
    London
    MS-Off Ver
    2007
    Posts
    27

    Re: Unable to get the Match property of the WorksheetFunction class

    Quote Originally Posted by jindon View Post
    try change that line to
    Please Login or Register  to view this content.
    Seems WorksheetFunction.Match method sometimes doesn't work as Match function in the cell.
    This is working perfectly... Thank you very much amigo!

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Unable to get the Match property of the WorksheetFunction class

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Unable to get the Match property of the WorksheetFunction class
    By oliverliu2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2022, 12:54 AM
  2. [SOLVED] Runtime error ‘1004’ unable to get the match property of the worksheetfunction class
    By DawidV in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2021, 04:17 AM
  3. Unable to get Match property of the WorksheetFunction class
    By pavu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2012, 10:00 AM
  4. Run-time error '1004': Unable to get the Match property of Worksheetfunction class
    By krish T in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-27-2010, 10:04 PM
  5. Run-time error 1004: Unable to get the Match property of the WorksheetFunction class
    By maffmommie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-13-2010, 09:32 AM
  6. run-time error '1004 Unable to get Match property of WorksheetFunction class
    By exl044 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2010, 02:23 AM
  7. Unable to get Match property of the WorksheetFunction class
    By C++User in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-03-2006, 09:55 AM

Tags for this Thread

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