+ Reply to Thread
Results 1 to 6 of 6

Problem when using Named Range instead of simple Range

  1. #1
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Problem when using Named Range instead of simple Range

    Here is my code: The code for Supplier1: works great. The code for Supplier2: throws an error. However, I really prefer to use Defined Names over simple ranges. There are only 3 lines that are different between Supplier1: and Supplier2: They are as follows:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Any help is greatly appreciated.

    Please Login or Register  to view this content.
    Product1 Defined Range:
    Please Login or Register  to view this content.
    PCost1 Defined Range:
    Please Login or Register  to view this content.
    Test Sheet
    Attached Files Attached Files

  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: Problem when using Named Range instead of simple Range

    This makes no sense.
    Please Login or Register  to view this content.
    With that code VBA will be looking for a named range with the name Product11048576.

    What are you actually trying to do here?
    Please Login or Register  to view this content.
    Are you trying to find the next empty row in the named range 'Product1'?
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: Problem when using Named Range instead of simple Range

    Yes. I need to find the first empty cell in Product1. I can make it work if Product1 is not empty. But if Product1 is empty i just get errors

  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: Problem when using Named Range instead of simple Range

    If Product1 is empty then it's likely that when you try and find the next empty row you'll end up in a row above the range Product1 refers to.

    Why are you using the named ranges anyway?

  5. #5
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: Problem when using Named Range instead of simple Range

    Quote Originally Posted by Norie View Post
    If Product1 is empty then it's likely that when you try and find the next empty row you'll end up in a row above the range Product1 refers to.

    Why are you using the named ranges anyway?
    Named Ranges allow me to insert columns without breaking the code for one

  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: Problem when using Named Range instead of simple Range

    If that's the only purpose then why are they dynamic named ranges?

    Couldn't you just use them for entire columns?

+ 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. [SOLVED] VLOOKUP and Fill Handle Problem: Selected Range vs. Named Range
    By Menenius in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-12-2016, 08:50 PM
  2. [SOLVED] Compare cells to named range and create new sheets using related named range
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-10-2015, 03:35 PM
  3. Simple Question: Resize a Named Range
    By Merf in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2015, 07:13 PM
  4. [SOLVED] named range problem
    By freshfruit in forum Excel General
    Replies: 2
    Last Post: 01-23-2014, 01:47 PM
  5. [SOLVED] Simple Copy of Named Range to another sheet
    By R.Koenig in forum Excel General
    Replies: 3
    Last Post: 02-11-2013, 02:45 PM
  6. Passing value of named range ... not working? should be simple no?
    By trillium in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2012, 02:25 AM
  7. [SOLVED] Determine what Named Range the Target Address is and return Named Range Name
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2012, 10:49 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