+ Reply to Thread
Results 1 to 5 of 5

Object Variable/With Block Not Set When Naming Ranges

  1. #1
    Registered User
    Join Date
    07-02-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Object Variable/With Block Not Set When Naming Ranges

    I get the "Object variable or With block not set" for the TempName.Address. This is the same code I use for 6 other variables I'm naming on 2 other sheets (this one being the 3rd) in the workbook.

    Could this be because the worksheet it is pulling from has multiple "TEMP" entries in column "A"? I didn't think it would do that if I specify it to select the 2 columns next to it....am I missing something obvious?


    I've attached a sample workbook that doesn't include everything just the error...
    Test_EX.xlsm

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Object Variable/With Block Not Set When Naming Ranges

    The problem is that the code to set the range is never executed.

    Try this.
    Please Login or Register  to view this content.
    Last edited by Norie; 07-09-2013 at 12:42 PM.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-02-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Object Variable/With Block Not Set When Naming Ranges

    Is there any reason why only this named range required this when my other ones did? Do you know?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Object Variable/With Block Not Set When Naming Ranges

    The error could have happened on any one of the names, depends on a few things.

    For example, which sheet was active when you ran the code.

    I know you are activating 'TMA' but it's always better explicitly referencing it in the code

  5. #5
    Registered User
    Join Date
    07-02-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2007
    Posts
    93

    Re: Object Variable/With Block Not Set When Naming Ranges

    Huh, okay. That makes sense. This program can be so touchy sometimes....Thank you!

+ 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