LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Change named range value

To anyone that can help....

I have a couple named ranges to which I like to assign different values
consecutively in a vba sub command.

Defined Named Ranges:
Name Range
-------------- -------------
TestRange1 =TestWorksheet1!$C$5
TestRange2 =TestWorksheet1!$D$5

Basically, in the sub I am able to set the value of TestRange1 or TestRange2
but not both.

Private Sub someSub() 'Called from CommandButton1_click()
Worksheets("TestWorksheet1").Range("TestRange1").v alue = "TEST Range 1"
Worksheets("TestWorksheet1").Range("TestRange2").v alue = "TEST Range 2"
End Sub

If i comment out the first line, then the second is executed. I tried to
capture a possible error, but the doesn't seem to be one.

I even tried to set the value through different means:

Private Sub someSub() 'Called from CommandButton1_click()
ActiveWorkbook.Names.Item("TestRange1").RefersToRa nge.value = "TEST1"
ActiveWorkbook.Names.Item("TestRange2").RefersToRa nge.value = "TEST2"
End Sub


Does anyone know why I can't assigne more than one value at a time?

TIA,

Joe
 
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
Change the starting and ending cell of a dynamic named range Arlen Excel Discussion (Misc queries) 2 August 8th 08 01:53 PM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM


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