+ Reply to Thread
Results 1 to 3 of 3

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

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    9

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

    I have created a serial number list and when a cell is selected within a specified range the macro "X"s the cell and vice versa. But when I click on a cell outside the range specified it throws an Run Time Error 91: Object Variable or With Block Variable not set. Any Insight would be greatly appreciated.


    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    08-02-2012
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Run Time Error 91: Object Variable or With Block Variable not set

    hi, I think the problem is because Intersect returns a range so you need to check if it is Nothing rather than False.

    change the first If statement from 'If Intersect(Target, rngToCheck) Then'

    to 'If Not Intersect(Target, rngToCheck) Is Nothing Then'

    see if that works for you.

  3. #3
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Run Time Error 91: Object Variable or With Block Variable not set

    Excelonthegrid,

    Thanks that worked!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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