PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Creating Charts using VBA

 
 
New Member
Join Date: Nov 2011
Posts: 1
 
      23rd Nov 2011
Hi! I need a little help with something. Using VBA to macro some excel data.
I want to create a chart using arrays created in Visual Basics, instead of from the cell range i excel.

What i'm refering to is the part in bold and dark red. It's actually a range of cell values in excel i assume, but the thing is that I've got different sets of data, where this specific data type is not always in the same position in the excel sheet. So I cant specify a set of range. So what i did was to convert that specific data type to an array, but I have no idea if I can create a chart, using that set of array.

Btw, i'm pretty new to programming, so my terms may not really be right :X

Example: from http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
Sub AddChartSheet()
Dim chtChart As Chart
'Create a new chart.
Set chtChart = Charts.Add
With chtChart
.Name = "Tool Sales2"
.ChartType = xlColumnClustered
'Link to the source data range.
.SetSourceData Source:=Sheets("Sheet1").Range("A1:H5"), _
PlotBy:=xlRows
.HasTitle = True
.ChartTitle.Text = "=Sheet1!R1C2"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Month"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Sales"
End With
End Sub


Ok i change the range from D5 to H5, coz with the colon it gives me =.=

Thanks alot!!

Last edited by iWiishh; 23rd Nov 2011 at 12:17 PM..
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:57 AM.