Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default dynamically naming ranges

use set statements in your code


for each sht in sheets
Set Range1 = .Range("A1:D4")
Set Range2 = .Range("B7:H4")
Set Range3 = .Range("G1:K4")

next sht

"KimC" wrote:

I have a workbook in which I want to run the same macros on each sheet. The
macros contain range names, so I know I will have to rename the ranges for
each sheet. Is there a way to programmatically change the macro range names
so that I can use the same set of macros for each sheet (there are MANY
sheets)? I am thinking something like incorporating the sheet name in the
range name when it is created by the code. I realize that the range names
that are created will have to be deleted after the macros are run to avoid
creating _1, _2, etc versions. Any help appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default dynamically naming ranges

Thank you so much--I'll try that

"joel" wrote:

use set statements in your code


for each sht in sheets
Set Range1 = .Range("A1:D4")
Set Range2 = .Range("B7:H4")
Set Range3 = .Range("G1:K4")

next sht

"KimC" wrote:

I have a workbook in which I want to run the same macros on each sheet. The
macros contain range names, so I know I will have to rename the ranges for
each sheet. Is there a way to programmatically change the macro range names
so that I can use the same set of macros for each sheet (there are MANY
sheets)? I am thinking something like incorporating the sheet name in the
range name when it is created by the code. I realize that the range names
that are created will have to be deleted after the macros are run to avoid
creating _1, _2, etc versions. Any help appreciated.

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
Dynamically Naming a Table of Data Ivor Davies Excel Discussion (Misc queries) 2 August 28th 09 07:02 AM
Dynamically Shifting Ranges RSquid Charts and Charting in Excel 1 July 31st 08 06:40 PM
Dynamically Changing Named Ranges [email protected] Excel Worksheet Functions 2 December 17th 07 08:04 PM
How to specify cell ranges dynamically? Agent Wild Excel Worksheet Functions 5 June 7th 06 10:37 AM
Quick question about dynamically adding and naming worksheets Robbyn Excel Programming 2 August 2nd 04 01:25 AM


All times are GMT +1. The time now is 02:13 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"