![]() |
Inserting labels and bars
Hi,
I have to generate a column graph for the following data: Quarterly sales by division (in thousands) Div 1 Div 2 Div 3 Div 4 Jan 549 542 670 640 Feb 845 259 360 961 Mar 852 391 296 425 I used the code mentioned below. Public Sub test() Dim cht As Excel.Chart Dim wsh As Excel.Worksheet Set cht = Charts.Add With cht .ChartType = xlColumnClustered .SetSourceData Source:=Sheets("Save a custom chart type").Range("B3:B5") .SetSourceData Source:=Sheets("Save a custom chart type").Range("C3:C5") .SetSourceData Source:=Sheets("Save a custom chart type").Range("D3:D5") Set wsh = ActiveWorkbook.Worksheets(1) With wsh.Shapes(1) .Top = 0 .Left = 0 .Width = 200 .Height = 200 End With End With End Sub But the output i needed was like this: x- axis has div1,2,3 with each div having three corresponding bars along with the category and labels. Can anyone suggest modificaitons to the code to get the desired format of graph? Would greatly appreciate help in this matter. Thanks in advance... |
All times are GMT +1. The time now is 07:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com