+ Reply to Thread
Results 1 to 8 of 8

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

  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

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

    What will happen:

    I want to clear specific worksheet contents.

    There is an checklist named [XcludeSheet] - it means if a worksheet name include there it will not be cleared.

    BUT error occur
    I give up! Why there is an error when the process is been process well.

    SITUATION ERROR:
    There is an 3 sheets

    Sheet1 to 3 -> in the list [XcludeSheet]
    Process start then ERROR appear

    Please Login or Register  to view this content.
    P.S. Is there any other way in my code? I use errorcatch to get the error and make it as an message.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

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

    Please Login or Register  to view this content.

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

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

    what exactly is XcludeSheet? an array or range?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

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

    Quote Originally Posted by AB33 View Post
    Please Login or Register  to view this content.
    Still not working

  5. #5
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

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

    Quote Originally Posted by JosephP View Post
    what exactly is XcludeSheet? an array or range?
    Joseph, it is a range [Name Range].

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

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

    this line
    Please Login or Register  to view this content.
    won't work then. perhaps
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

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

    Quote Originally Posted by JosephP View Post
    this line
    Please Login or Register  to view this content.
    won't work then. perhaps
    Please Login or Register  to view this content.
    Still the same with my code in the problem. My problem is that RUN-TIME ERROR.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

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

    unless the range name is in a public variable called XcludeSheet it will need to be wrapped in quotes to be treated as text.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

+ 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. Replies: 0
    Last Post: 04-16-2013, 07:15 AM
  2. Replies: 6
    Last Post: 12-21-2012, 08:03 AM
  3. Replies: 1
    Last Post: 09-25-2012, 08:03 PM
  4. [SOLVED] Intermittent Run-time Error 91: Object Variable or With Block variable not set
    By fraanchtoast in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-29-2012, 10:11 AM
  5. Run-Time error '91': Object variable of With block variable not set
    By jammin1911 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2006, 01:36 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