ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make a graph with for cycle (https://www.excelbanter.com/excel-programming/282260-make-graph-cycle.html)

ferrdav[_7_]

Make a graph with for cycle
 

Good Morning,

i get this problem: i have a worksheet like this:



A B C D
1 10/03 2 10/03 45
2 11/03 6 11/03 85
3 12/03 8 12/03 96
4 13/03 3 13/03 52


what i would like to do is a macro that make a graph taking columns A&B
and then a second grafh taking columns C&D and so on...

i wrote this, but it does not work (in my spreadsheet i get 146 columns
and 256 rows...):

For i = 1 To 146
Range(.Cells(i, 2), .Cells(i + 1, 256)).Select
Range(Selection, Selection.End(xlDown)).Select
Charts.Add
ActiveChart.ChartType = xlAreaStacked
ActiveChart.SetSourceData
Source:=Sheets("INDUSTRIALS").Range(.Cells(i, 2), .Cells(i + 1, 256)),
_
PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject,
Name:="INDUSTRIALS"
With ActiveChart
HasTitle = True
ChartTitle.Characters.Text = "Asset Swap Spread Bid"
Axes(xlCategory, xlPrimary).HasTitle = False
Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.Legend.Select
Selection.Delete
Next i
End Sub


any help? thank you!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Tushar Mehta

Make a graph with for cycle
 
In article ,
says...
<snip}

i wrote this, but it does not work (in my spreadsheet i get 146 columns
and 256 rows...):

<snip

How does it not work?

Also, what is your intent? One chart with 73 series in it? Or 73
charts with 1 series in each? Of course, neither seems aesthetically
appealing.

You might also want to check the Excel | Tutorials | 'Dynamic Charts'
page of my web site. One of the examples addresses how to select one
column from a list of many as the source for a chart.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...

Good Morning,

i get this problem: i have a worksheet like this:



A B C D
1 10/03 2 10/03 45
2 11/03 6 11/03 85
3 12/03 8 12/03 96
4 13/03 3 13/03 52


what i would like to do is a macro that make a graph taking columns A&B
and then a second grafh taking columns C&D and so on...

i wrote this, but it does not work (in my spreadsheet i get 146 columns
and 256 rows...):

For i = 1 To 146
Range(.Cells(i, 2), .Cells(i + 1, 256)).Select
Range(Selection, Selection.End(xlDown)).Select
Charts.Add
ActiveChart.ChartType = xlAreaStacked
ActiveChart.SetSourceData
Source:=Sheets("INDUSTRIALS").Range(.Cells(i, 2), .Cells(i + 1, 256)),
_
PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject,
Name:="INDUSTRIALS"
With ActiveChart
HasTitle = True
ChartTitle.Characters.Text = "Asset Swap Spread Bid"
Axes(xlCategory, xlPrimary).HasTitle = False
Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.Legend.Select
Selection.Delete
Next i
End Sub


any help? thank you!


------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




All times are GMT +1. The time now is 08:01 PM.

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