+ Reply to Thread
Results 1 to 7 of 7

Range.find returns "Nothing" in error, not sure of cause

  1. #1
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Range.find returns "Nothing" in error, not sure of cause

    So I have a userform with some listboxes, textboxes and frames on it (most of the textboxes are inside of frames). One listbox is populated with claim information and when a claim is selected, a range.find is used to locate the specific claim in a large EDI file. Once the claim is found, the textboxes are populated with various data regarding the claim. I also have a frame.click event set up so that when a person clicks on a specific frame a function is called that causes a message box to pop up with additional info for the claim.

    The problem I am running into is that once the frame is clicked and the message box comes up, clicking the listbox with claims on it causes the range.find to return "Nothing" even though it should not. If I were to click the listbox again without bringing up the message box, everything works fine. But when the message box is shown, it causes the range.find to malfunction and I have yet to be able to pinpoint the problem. They do not use same name variables. I had originally used a class module to produce the message box and thought that was the issue but after removing it the problem persists.

    Code for finding claim in EDI file
    Please Login or Register  to view this content.
    Code in module to show message box
    Please Login or Register  to view this content.
    Last edited by enphynity; 08-14-2013 at 04:03 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Range.find returns "Nothing" in error, not sure of cause

    The first code never calls MoreInfo or displays a message box.

    Also, there's not check in it for Find returning Nothing.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Re: Range.find returns "Nothing" in error, not sure of cause

    The first code isn't meant to call the function, it's just there to show where the error occurs.

    The point is that the range.find should not return "Nothing" as I have checked the data and it should definitely find something. If I replicate steps without bringing up the message box, the error does not occur.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Range.find returns "Nothing" in error, not sure of cause

    Have you stepped through the code checking all variables/values?

    By the way, what error are you referring to here?
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Re: Range.find returns "Nothing" in error, not sure of cause

    ptnRange ends up equaling "Nothing", which in turn causes the next line of code to give the "Object variable or With block variable not set". I have stepped thru multiple times and can find no variable overlap.

    Another thing worth noting, if I click on another listbox that is on the form which refreshes the listbox with the claims, then the code works. Could it have something to do with the claim listbox losing focus or needing to be refreshed?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Range.find returns "Nothing" in error, not sure of cause

    Ah, so the error is on the next line.

    Have you checked all the values?

    For example Remit.Claim_list.List(x, 6)?

    Also, have you tried the Find with all the arguments?

    If you omit arguments then the settings used can be those of the last Find operation.

  7. #7
    Registered User
    Join Date
    12-21-2006
    MS-Off Ver
    Office 2013
    Posts
    73

    Re: Range.find returns "Nothing" in error, not sure of cause

    So I changed
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    and it's working now! I guess one of those arguments was important haha.

    Thanks for the help and problem solving suggestion!

+ 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] Find expression causing "Subscript out of range" error
    By aseret in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-08-2013, 12:05 AM
  2. Error "Subscript out of range", cant seem to find where code is wrong
    By KeithMale in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-14-2013, 07:07 PM
  3. Replies: 3
    Last Post: 04-14-2013, 11:53 PM
  4. "Runtime error '-2147417848 (80010108)' Method 'find' of object 'Range' failed"
    By excelworker_1 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-14-2012, 09:53 AM
  5. Macro Error with code "Range("A65536").End(xlUp).EntireRow.Insert"
    By lukasj13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2010, 08:48 PM

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