View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Macro to insert named range in each sheet

What is the error? When you click on the "Debug" in the error window, what
line of code is highlighted? Otto
"rbanks" wrote in
message ...

Tom, Otto,

I have tried both of you suggestions, and they both error out.

Tom's

Sub addnames()
Dim v As Variant, i As Long
Dim sh As Worksheet
v = Array("Domestic CSCs", "Toronto CSC", "Vancouver CSC", "Winnipeg
CSC", _
"Calgary CSC", "Montreal CSC", "Halifax CSC", "Canadian DPS",
"Anchorage CSC", _
"Atlanta", "Boston CSC", "Chicago CSC", "Cincinnati CSC",
"Denver CSC", _
"Houston CSC", "Kansas City -CSC", "Los Angeles CSC", "Memphis
CSC", _
"Minneapolis CSC", "San Jose CSC", "Philadelphia CSC",
"Phoenix-CSC", _
"Pittsburgh-CSC", "Pontiac-CSC", "Portland CSC")
For i = LBound(v) To UBound(v)
Set sh = Worksheets(v(i))
sh.Range("A1:N256").Name = v(i)
Next
End Sub

Otto's

Sub NameRngs()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
With sh
Range("A1:N253").Name = sh.Name
End With
Next sh
End Sub


--
rbanks
------------------------------------------------------------------------
rbanks's Profile:
http://www.excelforum.com/member.php...fo&userid=2944
View this thread: http://www.excelforum.com/showthread...hreadid=526217