Automate bar graph for each line item in a dataset

excelnewbie12345

New member
Joined
Jun 25, 2019
Messages
8
Reaction score
0
Points
0
Excel Version(s)
16.24
I am new to excel and I'm trying to create a separate bar graph for each line item in my dataset. Is there a way to automate this process? The data is: class name, average grade for the final exam, final grade for the semester, and the delta. Right now I'm creating each bar graph manually and I know there has to be a way to automate this.
 
Hi and welcome
please post a sample sheet with some data and expected results ( no pics please) Click Go advanced - Manage attachments
 
Bar graph example

Hi,

Thank you for your response.
 

Attachments

  • Example.xlsx
    88.5 KB · Views: 10
Automate Bar graph in a data set

See if the solution is acceptable to you.
Hi there,

Thank you for your response. Were these bar graphs automatically created? I have to create each one manually. I was wondering if there was a way to automate the process.

THank you, again.
 
The attached has a button on the sheet which runs the following macro.
It takes the first (only) chart on the sheet and repeatedly copies it and adjusts its source data. So set that chart as you'd like it first. You can make your own adjustments to the code (see comments therein).
Code:
Sub blah()
lr = Cells(Rows.Count, "A").End(xlUp).Row
Set SceChart = ActiveSheet.ChartObjects(1)
Set destn = Range("F11")    'where the top of the first new chart will be
For r = 3 To lr
  With SceChart.Duplicate
    .Top = destn.Top    'position the new chart's top
    .Left = SceChart.Left    'position the new chart's left (in line with the first chart).
    .Chart.SetSourceData Source:=Range("Sheet1!$A$1:$D$1,Sheet1!$A$" & r & ":$D$" & r)
    Set destn = destn.Offset(8)    'where the top of the next new chart will be (8 cells down from the previous one)
  End With
Next r
End Sub
 

Attachments

  • ExcelGuru10077.xlsm
    23.5 KB · Views: 8
Last edited:
Back
Top