+ Reply to Thread
Results 1 to 4 of 4

Run Time Error 91, Object Variable or With Block Variable not set

  1. #1
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Run Time Error 91, Object Variable or With Block Variable not set

    I have this macros below that keeps giving me a Run Time Error 91, Object Variable or With Block Variable not set prompt at the line that begins "Loop While". I was wondering if this can be fixed. This was a problem that arose from an existing thread, as its a new issue I am reposting. Thank You.


    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Question regarding Run Time Error 91, Object Variable or With Block Variable not

    Try changing that line to
    Please Login or Register  to view this content.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Question regarding Run Time Error 91, Object Variable or With Block Variable not

    This line, which comes directly from Help, should NEVER be used:
    Please Login or Register  to view this content.
    If c is Nothing, then c.Address will error; and if c has an Address, it is not Nothing. (VBA always evaluates all arguments to a logical expression; if it paid attention to the And operator and quit after evaluating the first, it wouldn't be a problem)

    If the search ultimately ends by finding the first entry again, then you should use
    Please Login or Register  to view this content.
    If it ends because you are destroying the found value, then use
    Please Login or Register  to view this content.
    If either could happen then
    Please Login or Register  to view this content.
    Last edited by shg; 01-12-2011 at 02:11 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: Question regarding Run Time Error 91, Object Variable or With Block Variable not

    Thank you it worked great, I used the following code:

    Please Login or Register  to view this content.
    Last edited by undergraduate; 01-12-2011 at 02:11 PM.

+ 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