View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
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/