Home |
Search |
Today's Posts |
#1
|
|||
|
|||
variable range automation
I have two identical tables side by side and I'm trying to use one line of
code to work 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 |
#2
|
|||
|
|||
What do you want to do?
If you have to decide between two tables, you need a decision making statement and if you want to set a chart range you need a statement to do that. That's two statements. You could try and check if the IIF function will work within the SetSourceData. That is one statement to set the source range and one function which still comes to two 'things' to do. -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... I have two identical tables side by side and I'm trying to use one line of code to work 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I assign a range starting cell based on a variable locati. | Excel Discussion (Misc queries) | |||
How can I assign a range starting cell based on a variable locati. | Excel Worksheet Functions | |||
Define a range based on another named range | Excel Worksheet Functions | |||
empty variable range | Excel Discussion (Misc queries) | |||
variable range countif | Excel Worksheet Functions |