Macro Copy Active Cell to Range Name, loop
Sub NameMe()
Dim strName As String
Dim strAddr As String
strName = ActiveCell.Value
strAddr = ActiveCell.Address(, , xlR1C1)
ActiveWorkbook.Names.Add _
Name:=strName, _
RefersToR1C1:="=Sheet1!" & strAddr
End Sub
You can use Offset to move from cell to cell, and loop as required.
HTH
Ed
"zigstick" wrote in message
om...
Hi, I need to create a macro to run the following sequence:
1. Copy the Active Cell (say it's A1, "mark")
2. Move up to the Name Box at top left corner to name the cell range
(Is this correct for that location? -- ActiveWorkbook.Names.Add
Name:="servera", RefersToR1C1:="=Sheet1!R1C1"
3. Paste what was copied from the active cell and Enter, to name the
cell range.
4. Move to another cell, say A3 ("david) and restart the process,
copying the active cell (which will hold a different name)
Please use example below:
A B C D E
1 mark
2 john
3 david
4 larry
5 michael
Thanks!!!!
|