Defining Name based on adjacent cell.

sekar_r24

New Member
Joined
Apr 18, 2020
Messages
26
Office Version
  1. 2013
Platform
  1. Windows
Hi.,

I am trying to create name list for a column of cells. my values are in Column A up to specified no of rows (ex:3000 rows), i would like to assign name in B column corresponding rows. For ex: for LenZ in A1, the list name in B2, should be LenZ ( ie same name). i tried a lot but unable to increment the R1C1 value. Can anyone help on this. or anyother work around for this.

Thanks
Capture.PNG

VBA Code:
Sub kre3()
Dim rw As Integer, cl As Integer
rw = 1
cl = 2
If rw = 10 Then ActiveWorkbook.Names.Add Name:=Cells(rw, 1), RefersToR1C1:="=Sheet1!R[" & rw & "]C[" & cl & "]"
rw = rw + 1
End If End Su
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How about
VBA Code:
Sub CreateNames()
    Dim cel As Range
    For Each cel In Range("A1").Resize(Range("A" & Rows.Count).End(xlUp).Row)
        cel.Resize(, 2).CreateNames Top:=False, Left:=True, Bottom:=False, Right:=False
    Next cel
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top