I have recorded the macro but the problem is it is searching for Name and naming the column for D because it is recorded in that way. How to use the name manager for the specified search (Ex: Searching for Name then the macro should name the corresponding column only.
The code which I have is
Sub Macro1()
'
' Macro1 Macro
'
'
Cells.Find(What:="Name", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Columns("D:D").Select
ActiveWorkbook.Names.Add Name:="Name", RefersToR1C1:= _
"='Raw Data'!R2C3:INDEX('Raw Data'!C3,MATCH(REPT(""z"",255),'Raw Data'!C4,1))"
ActiveWorkbook.Names("Name").Comment = ""
End Sub
Bookmarks