Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How can we generate excel graphics with VBA?

user-image
Question added by mohamed kajji
Date Posted: 2013/05/21
Abdul Ghani
by Abdul Ghani , Senior Design Engineer , Fatin Home Furniture LLC

http://ce270.groups.et.byu.net/syllabus/vbaprimer/graphics/ I hope this will help you

Mutassem Watfa
by Mutassem Watfa , Finance Manager , Talas Group

Please Try this code....

 

Sub AddChartValues()On Error GoTo Err1Dim i, k As Integerk = InputBox("Enter the number of the Series")  Range("A1") = "Titles"  Range("B1") = "Values" For i =1 To k Range("A" & i +1) = InputBox("Enter the  title Number  " & i) Range("B" & i +1) = InputBox("Enter the Value " & i)    Next i   '''''''  ActiveSheet.Shapes.AddChart.Select    ActiveChart.ChartType = xl3DColumnStacked    ActiveChart.SetSourceData Source:=Range("A1:b" & i)     ActiveChart.SeriesCollection(1).ChartType = xlColumnClustered   ActiveChart.SeriesCollection(1).Trendlines.Add    ActiveChart.SeriesCollection(1).Trendlines(1).Select    With Selection        .Type = xlPolynomial        .Order =6    End With  ActiveChart.Legend.Select    ActiveChart.Legend.LegendEntries(2).Select    Selection.Delete     Exit SubErr1: End Sub

More Questions Like This