Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to write code to automatically create a series of chart using difference data when the macro is run. I am having a proble defining the chart ranges in the macro... This code works, using a static range: rng2 = "I2:I42" ActiveChart.SetSourceData Source:=Sheets("All").Range(rng2), _ PlotBy:=xlColumns But when I try to build the range string using the code below, I get runtime error 1004: T1 = 2 T2 = 42 rng3 = "I" + Str(T1) + ":" + "I" + Str(T2) ActiveChart.SetSourceData Source:=Sheets("All").Range(rng3), _ PlotBy:=xlColumns Looking at the differences of rng2 and rng3, the watch shows th following: rng2 "I2:I42" Type: Variant/String rng3 "I 2:I 42" Type: Variant/String I think the spaces in rng3 between the I's and the numbers are causin the problem, how do I get rid of these spaces??? Any other ideas o defining the range? I tried to use Range(Cells(T1,9),Cells(T2,9)), bu it did not work either... Thanks in advance, Da -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Zero problem with blank cell after automated data transfer | New Users to Excel | |||
CHARTING CODE ERROR | Excel Discussion (Misc queries) | |||
Why doesn't Excel 2007 record charting and office art macro code? | Excel Discussion (Misc queries) | |||
Automated graph problem | Excel Discussion (Misc queries) | |||
Precision problem with automated formula fill-in | Excel Worksheet Functions |