View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Code to name numerous ranges

Hi Howard,

Am Sun, 25 May 2014 22:55:58 -0700 (PDT) schrieb L. Howard:

I have a great deal of similar and adjacent ranges to name.

Starting in D3 and down to D100 I want the first named range to be mon_3, then mon_4 and on down to D100.


try:

Sub MyNameCoder()
Dim j As String
Dim i As Long

j = "mon"

With ActiveSheet
For i = 3 To 100
.Names.Add Name:=j & "_" & i, _
RefersTo:=.Range(.Cells(i, "D"), .Cells(i, "L"))
Next
End With

End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional