PC Review


Reply
Thread Tools Rate Thread

Changing Names of Multiple Cell Link Ranges - Forms DropDown

 
 
hdf
Guest
Posts: n/a
 
      20th May 2007
I have a series of drop down boxes created with the Forms menu. The
cell link range for each dropdown is different, as follows:

Cell Link Box1 = DemandBase_A_UndistExp1
Cell Link Box2 = DemandBase_A_UndistExp2
Cell Link Box3 = DemandBase_A_UndistExp3
Cell Link Box...n = DemandBase_A_UndistExp...n

I want to change them all at once to:

DemandBase_A_OtherCost1
DemandBase_A_OtherCost2
DemandBase_A_OtherCost...

I know I can change the entire name using the following code:

Sub Change_Drop_Link()

For Each bx In ActiveSheet.DropDowns
If bx.LinkedCell = "DemandBase_A_UndistExp1" Then
bx.LinkedCell = "DemandBase_A_OtherCost1"
End If
Next

End Sub

But this only replaces one name for another and would require to write
a new name for each change.

Is there anyway to just change the text part of the range name
"DemandBase_A_UndistExp" for "DemandBase_A_OtherCost" and thus do them
all at one go.

Also, the code I use above changes the names in the entire Active
Sheet. I just want to change them for the drop down boxes in a given
part of the sheet or a given range.

Any help will be greatly appreciated. Thank you.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGVnTA==?=
Guest
Posts: n/a
 
      21st May 2007
Sub Change_Drop_Link()
For Each bx In ActiveSheet.DropDowns
bx.LinkedCell = Replace(bx.LinkedCell, "UndistExp", "OtherCost", 1)
Next
End Sub

--
Good Luck,
Peg


"hdf" wrote:

> I have a series of drop down boxes created with the Forms menu. The
> cell link range for each dropdown is different, as follows:
>
> Cell Link Box1 = DemandBase_A_UndistExp1
> Cell Link Box2 = DemandBase_A_UndistExp2
> Cell Link Box3 = DemandBase_A_UndistExp3
> Cell Link Box...n = DemandBase_A_UndistExp...n
>
> I want to change them all at once to:
>
> DemandBase_A_OtherCost1
> DemandBase_A_OtherCost2
> DemandBase_A_OtherCost...
>
> I know I can change the entire name using the following code:
>
> Sub Change_Drop_Link()
>
> For Each bx In ActiveSheet.DropDowns
> If bx.LinkedCell = "DemandBase_A_UndistExp1" Then
> bx.LinkedCell = "DemandBase_A_OtherCost1"
> End If
> Next
>
> End Sub
>
> But this only replaces one name for another and would require to write
> a new name for each change.
>
> Is there anyway to just change the text part of the range name
> "DemandBase_A_UndistExp" for "DemandBase_A_OtherCost" and thus do them
> all at one go.
>
> Also, the code I use above changes the names in the entire Active
> Sheet. I just want to change them for the drop down boxes in a given
> part of the sheet or a given range.
>
> Any help will be greatly appreciated. Thank you.
>
>

 
Reply With Quote
 
hdf
Guest
Posts: n/a
 
      22nd May 2007
Peg,

Thank you very much, it works like a charm.

Is there any way to limit the changes to Drop Down boxes within a
certain range, rather than all boxes in an active sheet?

 
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
RE: Names and changing cell ranges Shane Devenshire Microsoft Excel Charting 0 12th Feb 2009 11:09 PM
Need to link dropdown box choice to another cell lrb Microsoft Excel Misc 6 12th Dec 2007 08:08 PM
Names of workbook cell ranges not accepted with some signs =?Utf-8?B?enp4eGNj?= Microsoft Excel Worksheet Functions 1 20th Aug 2007 02:02 PM
dropdown cell link changes when inserting a row =?Utf-8?B?dGFhdm8=?= Microsoft Excel Programming 3 12th Dec 2006 07:28 AM
Multiple Ranges for Combo Box in Forms =?Utf-8?B?Y2FsbF9WaXNod2E=?= Microsoft Excel Programming 2 8th Jun 2005 09:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:00 AM.