+ Reply to Thread
Results 1 to 2 of 2

Obect Variable not set error; variable already defined?

  1. #1
    Forum Contributor
    Join Date
    05-12-2014
    MS-Off Ver
    Excel 2013
    Posts
    131

    Obect Variable not set error; variable already defined?

    Hey folks! I have a weird little hangup here. Here's the code I'm using that I obtained from someone on the forums last month:
    Please Login or Register  to view this content.
    This thing flies until it hits this section towards the very bottom:
    Please Login or Register  to view this content.
    For some reason, it gives me "Error 91: Object variable or With block variable not set" on the .Cells.Find line. I'm assuming it has something to do with the sn variable, but it's already declared earlier in the code. Any ideas on what I'm missing? I tried moving the line into different areas, doing the unprotect sheet portion at different phases, and re-declaring the variable, but no luck.

    Any help would be stellar! Thanks

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

    Re: Obect Variable not set error; variable already defined?

    It means the value was not found, so the Find returns Nothing, and you can't refer to the Offset property of Nothing.

    As a matter of practice, you should always test the return value of a Find, and not assume it always finds something.
    Entia non sunt multiplicanda sine necessitate

+ 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. Obect Required error when variable already set earlier in sub?
    By mrbusto71 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2016, 09:00 PM
  2. Variable Error '1004' - Application-defined or object-defined error
    By christopheralan88 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-01-2015, 12:09 AM
  3. [SOLVED] variable not defined error.
    By ratdogexcel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2014, 10:30 AM
  4. [SOLVED] Variable not defined error
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2013, 01:21 PM
  5. [SOLVED] Variable not defined error
    By janeml in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-07-2013, 07:36 PM
  6. variable not defined error
    By amartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2013, 06:39 PM
  7. Variable not defined error when I have defined the variable
    By jeffadkisson in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-27-2012, 07: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