Cell Naming

  • Thread starter Thread starter Grymjack
  • Start date Start date
G

Grymjack

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
 
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
 
excelent said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top