PC Review


Reply
Thread Tools Rate Thread

Change defined name ranges simultaneously

 
 
Marlene.Sawhney@gmail.com
Guest
Posts: n/a
 
      26th Mar 2007
Hello....

I have a defined name range "SWP" that currently refers to cells
A2234. However, I need it to update to read A27:F39. This name
range is used in about 75 spreadsheets, however it looks like I have
to change SWP manually for each spreadsheet. Does anyone have a macro
to help change this range or an easy way to update this?

Thank you!!

 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      26th Mar 2007
If, by spreadsheets, you mean 75 worksheets in a single workbook, with
SWP defined as a sheet-level name, then one way:

Public Sub ChangeSWP()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Range("A27:F39").Name = ws.Name & "!SWP"
Next ws
End Sub

If instead you mean you have 75 workbooks with SWP defined as a workbook
level name, then one way:

Public Sub ChangeSWP()
ActiveWorkbook.Sheets("Sheet1").Range("A27:F39").Name = "SWP"
End Sub


In article <(E-Mail Removed)>,
(E-Mail Removed) wrote:

> Hello....
>
> I have a defined name range "SWP" that currently refers to cells
> A2234. However, I need it to update to read A27:F39. This name
> range is used in about 75 spreadsheets, however it looks like I have
> to change SWP manually for each spreadsheet. Does anyone have a macro
> to help change this range or an easy way to update this?
>
> Thank you!!

 
Reply With Quote
 
Marlene.Sawhney@gmail.com
Guest
Posts: n/a
 
      26th Mar 2007
On Mar 26, 10:42 am, JE McGimpsey <jemcgimp...@mvps.org> wrote:
> If, by spreadsheets, you mean 75 worksheets in a single workbook, with
> SWP defined as a sheet-level name, then one way:
>
> Public Sub ChangeSWP()
> Dim ws As Worksheet
> For Each ws In ActiveWorkbook.Worksheets
> ws.Range("A27:F39").Name = ws.Name & "!SWP"
> Next ws
> End Sub
>
> If instead you mean you have 75 workbooks with SWP defined as a workbook
> level name, then one way:
>
> Public Sub ChangeSWP()
> ActiveWorkbook.Sheets("Sheet1").Range("A27:F39").Name = "SWP"
> End Sub
>
> In article <1174917514.507298.310...@o5g2000hsb.googlegroups.com>,
>
>
>
> Marlene.Sawh...@gmail.com wrote:
> > Hello....

>
> > I have a defined name range "SWP" that currently refers to cells
> > A2234. However, I need it to update to read A27:F39. This name
> > range is used in about 75 spreadsheets, however it looks like I have
> > to change SWP manually for each spreadsheet. Does anyone have a macro
> > to help change this range or an easy way to update this?

>
> > Thank you!!- Hide quoted text -

>
> - Show quoted text -


Thank you! I did mean worksheets. I tried to run the macro and I
have an error that says : "Runtime error 1004: This name is not
valid." However, the name of the defined range is SWP, so I'm not
sure what name its actually calling invalid.

Any ideas ? THANKS!

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      26th Mar 2007
If the worksheet contains a space or other special character, it must be
enclosed in single quotes:

ws.Range("A27:F39").Name = "'" & ws.Name & "'!SWP"

Use this line anyway. If you don't need the single quotes, Excel removes
them without complaining.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Mar 26, 10:42 am, JE McGimpsey <jemcgimp...@mvps.org> wrote:
>> If, by spreadsheets, you mean 75 worksheets in a single workbook, with
>> SWP defined as a sheet-level name, then one way:
>>
>> Public Sub ChangeSWP()
>> Dim ws As Worksheet
>> For Each ws In ActiveWorkbook.Worksheets
>> ws.Range("A27:F39").Name = ws.Name & "!SWP"
>> Next ws
>> End Sub
>>
>> If instead you mean you have 75 workbooks with SWP defined as a workbook
>> level name, then one way:
>>
>> Public Sub ChangeSWP()
>> ActiveWorkbook.Sheets("Sheet1").Range("A27:F39").Name = "SWP"
>> End Sub
>>
>> In article <1174917514.507298.310...@o5g2000hsb.googlegroups.com>,
>>
>>
>>
>> Marlene.Sawh...@gmail.com wrote:
>> > Hello....

>>
>> > I have a defined name range "SWP" that currently refers to cells
>> > A2234. However, I need it to update to read A27:F39. This name
>> > range is used in about 75 spreadsheets, however it looks like I have
>> > to change SWP manually for each spreadsheet. Does anyone have a macro
>> > to help change this range or an easy way to update this?

>>
>> > Thank you!!- Hide quoted text -

>>
>> - Show quoted text -

>
> Thank you! I did mean worksheets. I tried to run the macro and I
> have an error that says : "Runtime error 1004: This name is not
> valid." However, the name of the defined range is SWP, so I'm not
> sure what name its actually calling invalid.
>
> Any ideas ? THANKS!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
summing to defined ranges keerthyV Microsoft Excel Worksheet Functions 2 8th Apr 2009 08:05 AM
Auto change defined name ranges on Jan 1st annually MarathonMan Microsoft Excel Worksheet Functions 0 22nd Sep 2005 11:02 PM
dynamic defined ranges Thomas Pike Microsoft Excel Worksheet Functions 1 14th Sep 2005 12:29 AM
defined name ranges =?Utf-8?B?QmVu?= Microsoft Excel Programming 0 19th Aug 2005 07:12 PM
Excel Defined ranges Strider76 Microsoft ASP .NET 0 13th Apr 2004 04:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:16 PM.