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 |
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/ |
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 |
All times are GMT +1. The time now is 02:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com