#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Named Ranges

Hello,

I have four worksheets that have labels in exactly the same cells as each
other.

What I want to do is create named ranges in one worksheet, and then copy
them over to the other worksheets so that I only have to change the name of
the sheet that the range is referring to (as the cells are the same).

I know how to make named ranges in one worksheet....I'm looking for a quick
way to copy those named ranges to the other worksheets.

I hope this makes sense - thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Named Ranges

How about a macro?

If yes, group all the sheets you need.
(click on the first worksheet tab and ctrl-click on subsequent)

Then run this macro:

Option Explicit
Sub testme()

Dim myAddr As Variant
Dim myNames As Variant
Dim wks As Worksheet
Dim iCtr As Long

myAddr = Array("a1", "b3:c99", "D:D", "A:E")
myNames = Array("Name1", "Name2", "Name3", "Name4")

If UBound(myAddr) < UBound(myNames) Then
MsgBox "design error"
Exit Sub
End If

For Each wks In ActiveWindow.SelectedSheets
With wks
For iCtr = LBound(myAddr) To UBound(myAddr)
.Range(myAddr(iCtr)).Name = "'" & .Name & "'!" & myNames(iCtr)
Next iCtr
End With
Next wks

End Sub

And when you're done, ungroup those sheets!

This create worksheet level names for each of the selected sheets.


James Hamilton wrote:

Hello,

I have four worksheets that have labels in exactly the same cells as each
other.

What I want to do is create named ranges in one worksheet, and then copy
them over to the other worksheets so that I only have to change the name of
the sheet that the range is referring to (as the cells are the same).

I know how to make named ranges in one worksheet....I'm looking for a quick
way to copy those named ranges to the other worksheets.

I hope this makes sense - thanks.


--

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
Named Ranges Epinn Excel Worksheet Functions 23 October 16th 06 07:27 AM
named ranges UsGrant_75 Excel Worksheet Functions 2 June 23rd 06 01:38 AM
Named Ranges Joe Gieder Excel Worksheet Functions 2 February 16th 06 01:31 AM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
Named Ranges Donna Excel Discussion (Misc queries) 3 February 1st 05 11:35 PM


All times are GMT +1. The time now is 10:50 AM.

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

About Us

"It's about Microsoft Excel"