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