Selasa, 21 Februari 2012

[ExcelVBA] Problem with charts

 

Hi all,

I'm trying to add series to a chart while there is any text info in Column A (titles) and there is any value in Column E.
It is a simple barchart with some values in Y-Axis (column E) and the series titles as X-axis (column is A). I created a loop but the chart doesn't show all titles in X-axis. X-axis only shows the first name. Can anybody help me?

I'm attaching the code:

Sub AddNewSeries()

Dim f1 As Integer
Dim FacVal As Range
Dim FacName As Range

ActiveSheet.Shapes("faculty").Select

Range("A20").Select
Set FacName = ActiveCell
Do While Len(FacName) > 1
ActiveCell.Offset(0, 4).Range("A1").Select
f1 = ActiveCell
If f1 > 0 Then
Set FacVal = ActiveCell
ActiveSheet.Shapes("faculty").Select
With ActiveChart.SeriesCollection.NewSeries
.Name = FacName
.XValues = FacName
.Values = FacVal
ActiveCell.Offset(1, -4).Range("A1").Select
Set FacName = ActiveCell
End With
Else
ActiveCell.Offset(1, -4).Range("A1").Select
Set FacName = ActiveCell
End If
Loop

End Sub

Thank you.

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar