+ Reply to Thread
Results 1 to 3 of 3

Cell Naming

  1. #1
    Grymjack
    Guest

    Cell Naming

    Ok, I have a problem. I have to name a large number of cells in
    different sheets. I'm hoping that there is a way in a macro, or some
    other way to define these in an easier way other than one by one. Here
    is an example:

    1 2 3 4
    1001 --------- --------- --------- ---------
    1002 --------- --------- --------- ---------
    1209 --------- --------- --------- ---------
    1210 --------- --------- --------- ---------


    This would be the column and row headers for the cells. Below is how
    the cells would have to be named:


    1 2 3 4
    1001 S_1001_01 S_1001_02 S_1001_03 S_1001_04
    1002 S_1002_01 S_1002_02 S_1002_03 S_1002_04
    1209 S_1209_01 S_1209_02 S_1209_03 S_1209_04
    1210 S_1210_01 S_1210_02 S_1210_03 S_1210_04


    There are thousands of cells I have to name in a similar fashion. Is
    there a shortcut way to define these cells through a macro? Thanks in
    advance for any help any of you may pass my way.

    -Dan Canham




  2. #2
    excelent
    Guest

    RE: Cell Naming

    Some like this:

    Sub MultiName()

    Dim r As Long
    For r = 1001 To 2000
    Cells(r, 1).Name = "S_" & r & "_01"
    Cells(r, 2).Name = "S_" & r & "_02"
    Cells(r, 3).Name = "S_" & r & "_03"
    Cells(r, 4).Name = "S_" & r & "_04"
    Next

    End Sub


  3. #3
    Grymjack
    Guest

    Re: Cell Naming

    excelent wrote:
    > Some like this:
    >
    > Sub MultiName()
    >
    > Dim r As Long
    > For r = 1001 To 2000
    > Cells(r, 1).Name = "S_" & r & "_01"
    > Cells(r, 2).Name = "S_" & r & "_02"
    > Cells(r, 3).Name = "S_" & r & "_03"
    > Cells(r, 4).Name = "S_" & r & "_04"
    > Next
    >
    > End Sub
    >

    Thanks for the help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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