+ Reply to Thread
Results 1 to 10 of 10

Error 91 on finding date

  1. #1
    Registered User
    Join Date
    06-25-2018
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    92

    Error 91 on finding date

    Howdy!

    I have a code to search a table and return the exchange rate, but it's not working.

    Please Login or Register  to view this content.
    I'm getting the error on the marked line. Any help is appreciated. Thanks.
    Last edited by NickNunes; 03-11-2019 at 06:19 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Error 91 on finding date

    First, you should never try and use the result of a Find operation without testing it was actually found. Second, what is fechadelcontrato? If it's a variable, where and how is it declared?
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    06-25-2018
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    92

    Re: Error 91 on finding date

    fechadelcontrato is a public variable declared at the top of the code (Double checked, it's there)

    Please Login or Register  to view this content.
    How exactly do I check it was actually found? I'm using a value that I know for a fact it's in the table.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Error 91 on finding date

    You test for Nothing:

    Please Login or Register  to view this content.
    Are the values in the range literal values, or the result of formulas? Do they include time parts, or are they just date values?

  5. #5
    Registered User
    Join Date
    06-25-2018
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    92

    Re: Error 91 on finding date

    Just date values, not a result of a formula or anything. No time parts either.

    Also, it is indeed returning nothing

    Please Login or Register  to view this content.
    Last edited by NickNunes; 03-11-2019 at 07:16 AM. Reason: Pasted the code

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Error 91 on finding date

    If you use this instead of Find, does it find the value?

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-25-2018
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    92

    Re: Error 91 on finding date

    Using that code I get error 424 object required

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Error 91 on finding date

    Sorry - change dayCount to be a Long, not Range.

  9. #9
    Registered User
    Join Date
    06-25-2018
    Location
    Madrid, Spain
    MS-Off Ver
    2013
    Posts
    92

    Re: Error 91 on finding date

    And now I get a compiling error "object required"

    Please Login or Register  to view this content.
    Edit: My bad, forgot to delete the "Set" before. Now it works
    Last edited by NickNunes; 03-11-2019 at 07:47 AM.

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,282

    Re: Error 91 on finding date

    You don't need the Is Nothing test now, but really we should still test to make sure it was foind, like this:

    Please Login or Register  to view this content.

+ 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] Finding Date Values Creating Error?
    By Jenn68 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-09-2019, 07:46 PM
  2. [SOLVED] Finding Dates Within Date Range (Based on Today's Date) Whilst Matching Name?
    By EduardStoo in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-08-2019, 10:31 AM
  3. [SOLVED] Request help finding text next to a date, finding the same date in another column...
    By Biff Malibu 636 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-11-2016, 12:34 AM
  4. Replies: 3
    Last Post: 05-16-2014, 01:23 AM
  5. Finding File Creation date, saved date and last modified date
    By david systems in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2013, 05:49 PM
  6. Error in macro for finding todays date
    By Saturn in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-12-2011, 03:04 PM
  7. Replies: 1
    Last Post: 05-27-2006, 04:00 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