Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default setting a range variable equal to the value of a string variable

Is it possible to set a range variable as the value of a strin
variable. For instance, I'm trying to set a string variable equal t
the address of several discontiguous cells, then set the a rang
variable equal to the cell locations and put them in a chart. I'v
loaded several cell locations in a string variable so the variable ha
a value like:

StrVar = "A1,A7,A34,A34"

But if I try

RangeVar = Range(StrVar)

or

RangeVar = Range("StrVar")

It tries to evluate StrVar as a cell or cell name. Can I get the rang
mode to use the value of StrVar instead of the variable itself

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default setting a range variable equal to the value of a string variable

strVar = "A1,A7,A34,A34"
Set myRange = Range(strVar)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Pilgrim " wrote in message
...
Is it possible to set a range variable as the value of a string
variable. For instance, I'm trying to set a string variable equal to
the address of several discontiguous cells, then set the a range
variable equal to the cell locations and put them in a chart. I've
loaded several cell locations in a string variable so the variable has
a value like:

StrVar = "A1,A7,A34,A34"

But if I try

RangeVar = Range(StrVar)

or

RangeVar = Range("StrVar")

It tries to evluate StrVar as a cell or cell name. Can I get the range
mode to use the value of StrVar instead of the variable itself?


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default setting a range variable equal to the value of a string variable

oops, guess i forgot the "Set" in my post. my code does look like

Set RangeVar = (strVar)

But when I try to set the XValues of a series in a chart, it say
"Unable to set the XValues property of the Series class." And movin
the cursor over the RangeVar variable, it says that RangeVar is equa
to the value of first cell in the range even though it is a rang
variable, not an integer, string, single, or anything else. It seem
that the range is not loading into the variable properly. It eve
seems to be doing this if i set the range directly equal to the strin
of cells I want and not the variable. Any ideas

--
Message posted from http://www.ExcelForum.com

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
Setting a string variable as the file name [email protected] Excel Discussion (Misc queries) 1 March 28th 07 11:10 PM
Setting range value to a variable Todd Excel Programming 4 June 2nd 04 04:51 PM
How do I convert an integer variable to a string variable? dumbass Excel Programming 2 May 21st 04 07:34 PM
Join string with variable name to get variable value Dianne Excel Programming 6 February 12th 04 04:24 AM
Setting up a variable print range Gary[_5_] Excel Programming 5 July 31st 03 04:32 AM


All times are GMT +1. The time now is 02:40 PM.

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

About Us

"It's about Microsoft Excel"