Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 25
Default same range name in different sheets

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


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 897
Default same range name in different sheets

If you were interested in doing this programmatically, you could do
something like this:

Dim i As Long
For i = 1 to Worksheets.Count
Worksheets(i).Names.Add Name:="salesmonth1", RefersToR1C1:= "=" &
Worksheets(i).Name & "!R5C2:R18C5"
Next i

In the end, cells B5:E18 of each worksheet would be named
"salesmonth1"

--JP

On Nov 26, 3:03 am, "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


  #3   Report Post  
Posted to microsoft.public.excel.misc
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
comparing 2 sheets with a range rory_r[_2_] Excel Discussion (Misc queries) 2 November 5th 08 06:26 PM
INDIRECT for range of sheets mr tom Excel Worksheet Functions 6 April 23rd 07 09:13 PM
Referencing a Range of Sheets [email protected] Excel Discussion (Misc queries) 3 February 12th 07 09:47 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
Common range name for 2 sheets David Excel Discussion (Misc queries) 6 January 24th 06 03:26 PM


All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"