+ Reply to Thread
Results 1 to 7 of 7

Run-time error '91': Object variable or With block variable not set

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Run-time error '91': Object variable or With block variable not set

    Hello. I have the below code in my worksheet. There is no other code but that listed below in the worksheet.

    Please Login or Register  to view this content.
    If I click in any cell in rows 1 through 12, I receive a "Run-time error '91'" message. I need to be able to click and type in a few cells in rows 1 through 12. How do I avoid this error?

    Thanks!
    Last edited by arlu1201; 01-08-2013 at 02:04 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: Run-time error '91': Object variable or With block variable not set

    When do you want that code to run?

    Is there a particular range?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Run-time error '91': Object variable or With block variable not set

    The code must run on SelectionChange. If I understand the second question correctly, there is no particular range for the cells in rows 1 through 11.

  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: Run-time error '91': Object variable or With block variable not set

    So if I select a cell in row 456 column Z the code should run?

  5. #5
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Run-time error '91': Object variable or With block variable not set

    Yes. It should run for all cells except rows 1 through 12.

  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: Run-time error '91': Object variable or With block variable not set

    Try this.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-09-2012
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Run-time error '91': Object variable or With block variable not set

    This works! Thank you very much Norie.

+ 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