Thread: add names
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default add names

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 1/23/2008 by Joel Warburg
'

'
For RowCount = 1 To 35
ActiveWorkbook.Names.Add Name:=Range("A" & RowCount), _
RefersTo:="=" & Range("B" & RowCount)
Next RowCount
End Sub

For Each nm In ActiveWorkbook.Names
nm.Delete
Next nm


"Scott" wrote:

I have to define a few dozens of names in an Excel files. I put all the names
in Range ("A1:A35") and their respective addresses in Range ("B1:B35"), such
as "sheet1!$a$1:$c$20". What is the macro to run this job?

Also, want to know what are the codes to delete all these names later on if
necessary.

Thanks.