EASY Naming a Range of cells

  • I can not figure out how to simply name a range of cells in my assignment. We have to write our own vba code, otherwise i know how to name it through excel. No online links help either. How can I name cells A1:G8 as "GRADES" ? I know it's simple but I have not got it yet.

  • Hello and Welcome to the Forum :)


    You could test the following


    Code
    Sub AddRangeName()
        ActiveWorkbook.Names.Add Name:="GRADES", RefersTo:="=Sheet1!A1:G8"
    End Sub

    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Hi wendyl


    Try this:

    Code
    Sub Name_Area()
        Range("A1:G8").Select
        ActiveWorkbook.Names.Add Name:="GRADES", RefersToR1C1:="=Sheet1!R1C1:R8C7"
        Range("A1").Select
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!