variable range automation
I have two identical tables side by side and I'm trying to use one line of
code to create a chart for both tables. How do I write a variable range? My code is as follows: If intColumns = 0 Then ActiveChart.SetSourceData Source:=Sheets("cbot").Range("A2:E30"), PlotBy:= _ xlColumns Else ActiveChart.SetSourceData Source:=Sheets("cbot").Range("I2:M30"), PlotBy:= _ xlColumns End If -- Ryan Proudfit |
variable range automation
Create a dynamic range name to use as your chart source
Dynamic ranges are described in the following support article. http://support.microsoft.com/default...b;en-us;830287 then refer to the range name in your code: ie: instead of using Range("A2:E30"), you can use Range("DataSource") assuming my named range is called DataSource "Ryan Proudfit" wrote: I have two identical tables side by side and I'm trying to use one line of code to create a chart for both tables. How do I write a variable range? My code is as follows: If intColumns = 0 Then ActiveChart.SetSourceData Source:=Sheets("cbot").Range("A2:E30"), PlotBy:= _ xlColumns Else ActiveChart.SetSourceData Source:=Sheets("cbot").Range("I2:M30"), PlotBy:= _ xlColumns End If -- Ryan Proudfit |
All times are GMT +1. The time now is 08:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com