ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Graph Macro (https://www.excelbanter.com/excel-programming/295296-graph-macro.html)

Ben Allen

Graph Macro
 
I have created a macro which produces a graph. It calls a macro which
selects the cells i need, and then creates the graph. How can i make the
line
ActiveChart.SetSourceData Source:=Sheets("GraphTemp").Range("A1:B8"),
PlotBy:= _
xlColumns

Read

ActiveChart.SetSourceData Source:=Sheets("GraphTemp").Range(Selection),
PlotBy:= _
xlColumns

So that the graph is created using the current selection rather than a set
range of cells.
Thanks in advance.
--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is enough!"



K Dales

Graph Macro
 
Ben, you are so close:

ActiveChart.SetSourceData Source:=Selection,
PlotBy:=xlColumns

That should do it, I think.
Ken

-----Original Message-----
I have created a macro which produces a graph. It calls a

macro which
selects the cells i need, and then creates the graph. How

can i make the
line
ActiveChart.SetSourceData Source:=Sheets

("GraphTemp").Range("A1:B8"),
PlotBy:= _
xlColumns

Read

ActiveChart.SetSourceData Source:=Sheets

("GraphTemp").Range(Selection),
PlotBy:= _
xlColumns

So that the graph is created using the current selection

rather than a set
range of cells.
Thanks in advance.
--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is

enough!"


.



All times are GMT +1. The time now is 02:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com