Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Ryan Proudfit
 
Posts: n/a
Default 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   Report Post  
Tushar Mehta
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I assign a range starting cell based on a variable locati. feman007 Excel Discussion (Misc queries) 1 March 9th 05 11:41 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Worksheet Functions 3 March 9th 05 11:40 PM
Define a range based on another named range Basil Excel Worksheet Functions 2 February 21st 05 01:47 PM
empty variable range S1 Excel Discussion (Misc queries) 5 January 28th 05 02:33 PM
variable range countif JK Excel Worksheet Functions 3 November 3rd 04 07:50 AM


All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"