Define name automatically
Ahhh...
or:
Dim i As Long
For i = 1 To 234
Cells(i, "A").Resize(, 4).Name = "row" & i
Next i
But I'd use:
Dim i As Long
For i = 1 To 234
Cells(i, "A").Resize(, 4).Name = "row" & format(i,"000")
Next i
I like row001, row002, ...
Herbert wrote:
Hi,
Arne is right, all created names refer to A1:D1
Try this:
Dim oName As Name, nRow As Long
Dim oSheet As Worksheet
Set oSheet = ActiveSheet
For nRow = 1 To 20
oSheet.Names.Add "row" & nRow, "=" & oSheet.Name & "!$A$" & nRow &
":$D$" & nRow
Next nRow
Regards,
Herbert
"arne" wrote:
Tried it. It gives different name for the same range
=Sheet1!$A$1:$D$1
In selected range, for example a1:d234 I need to
give a1:d1 the name row1,a2:d2 the name row2 and so on..
Any suggestions?
Using excel 2000.
Arne
--
Dave Peterson
|