+ Reply to Thread
Results 1 to 2 of 2

Working with Named Ranges

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Working with Named Ranges

    I created a simply macro that will adjust the headings of a group of cells as follows.

    But if I add a row/column to the sheet, it will then of course attempt to place the headings in the wrong cells.

    I have now given that group of cells/range a Name of "AR_Buckets". But I'm not certain how to modify the macro to ensure it always places the information in the correct place.

    Can anyone help some?

    Sub AR_InvoiceDate()
        Range("D8").Select
        ActiveCell.FormulaR1C1 = "'1-30"
        Range("E8").Select
        ActiveCell.FormulaR1C1 = "'31-60"
        Range("F8").Select
        ActiveCell.FormulaR1C1 = "'61-90"
        Range("G8").Select
        ActiveCell.FormulaR1C1 = "'91-120"
        Range("H8").Select
        ActiveCell.FormulaR1C1 = "'Over 120"
        Range("H9").Select
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Working with Named Ranges

    Well, I keep teaching myself and maybe did it correct

    I assigned a name range to first cell, and then used an offset for each other as follows. Is the below the best method to assign values to a group of named cells?

    [code]
    Sub AR_InvoiceDate()
    Range("ARBucket_1") = "'1-30"
    Range("ARBucket_1").Offset(0, 1) = "'31-60"
    Range("ARBucket_1").Offset(0, 2) = "'61-90"
    Range("ARBucket_1").Offset(0, 3) = "'91-120"
    Range("ARBucket_1").Offset(0, 4) = "'Over 120"
    End Sub
    [\code]

+ 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: 1
    Last Post: 09-12-2012, 06:43 AM
  2. [SOLVED] Code to List Named Ranges for each Sheet not working
    By leaning in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-19-2012, 11:13 AM
  3. Working with various Ranges (Named Range) and Worsheet Events
    By aefavant in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2010, 03:30 PM
  4. Working named ranges in multiple sheets from vba
    By brucemc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2007, 09:07 PM
  5. [SOLVED] Problem Working with Named Ranges
    By montgomerymouse in forum Excel General
    Replies: 2
    Last Post: 01-10-2005, 07:06 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