View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default same range name in different sheets

On mo

Option Explicit
Sub testme()

Dim iCtr As Long
Dim wks As Worksheet

iCtr = 0
Do
iCtr = iCtr + 1

Set wks = Nothing
On Error Resume Next
Set wks = Worksheets("year" & iCtr)
On Error GoTo 0

If wks Is Nothing Then
Exit Do
End If

wks.Range("A1:b99").Name = "'" & wks.Name & "'!salesmonth1"
Loop

End Sub


Gilbert DE CEULAER wrote:

I have several sheets in the same workbook (e.g. year1, year2, year3,...).
I would like to name the same range in every sheet by the same name (e.g.
salesmonth1)
Is there a way to do this "in one move", I mean without going from sheet to
sheet.
Thanks in advance
Gilbert


--

Dave Peterson