+ Reply to Thread
Results 1 to 4 of 4

Create named ranges using the first row

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    Create named ranges using the first row

    Hello sir, I'm new to VBA and looking for a quick help.

    I want to create named ranges using a VBA. In my Excel file, the first row provides the heading of each column. I want to use these headings to create named ranges for each column in the selected area. A sample file is attached.

    1) If the heading of the column is empty, then ignore this column for named range.

    2) The range is subject to selection. For example, if I select area of A2:C50, then the range for each column is from row 2 to row 50. In this case range A2:A50 will be named as 'Sales', range B2:B50 has no name (due to empty value of B1), and range C2:C50 will be named as 'Growth'. Of course, if I select area of A2:C100, then the row stops at 100th.

    Thank you a lot.
    Attached Files Attached Files
    Last edited by alice2011; 05-20-2015 at 11:38 AM.

  2. #2
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    Re: Create named ranges using the first row

    Just quickly edited it to make my question clearer

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Create named ranges using the first row

    Not really an elegant solution, but this works.


    Please Login or Register  to view this content.
    Last edited by walruseggman; 05-20-2015 at 12:14 PM.

  4. #4
    Forum Contributor
    Join Date
    01-16-2014
    Location
    London
    MS-Off Ver
    Excel 2003 Excel 2010
    Posts
    189

    Re: Create named ranges using the first row

    Hi walruseggman, your macro works like a magic. Really does the job. Thank you so much. It's really useful for my task

+ 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. VBA To Create Named Ranges
    By tschuman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2013, 03:07 PM
  2. [SOLVED] Create named ranges using a macro?
    By billj in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-11-2013, 11:19 AM
  3. Excel 2007 : Using named ranges to create charts
    By EUROSTAT in forum Excel General
    Replies: 7
    Last Post: 01-09-2010, 09:13 PM
  4. Create named ranges
    By loopoo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2005, 09:16 AM
  5. Using VB to to create named ranges
    By PC in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-19-2005, 06:06 AM

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