VBA code to arrange the charts
Sub CreateGridOfCharts()
Dim int_cols As Integer
int_cols = 3
Dim cht_width As Double
cht_width = 250
Dim cht_height As Double
cht_height = 200
Dim offset_vertical As Double
offset_vertical = 195
Dim offset_horz As Double
offset_horz = 40
Dim sht As Worksheet
Set sht = ActiveSheet
Dim count As Integer count = 0
'iterate through ChartObjects on current sheet
Dim cht_obj As ChartObject
For Each cht_obj In sht.ChartObjects
'use integer division and Mod to get position in grid
cht_obj.Top = (count / int_cols) * cht_height + offset_vertical
cht_obj.Left = (count Mod int_cols) * cht_width + offset_horz
cht_obj.Width = cht_width
cht_obj.Height = cht_height
count = count + 1
Next cht_obj
End Sub
VBA code for chart formatti ng (for constant width of bars)
‘https://www.thespreadsheetguru.com/blog/2015/3/1/the-vba-coding-guide-for-excel-charts-graph
‘https://stackoverflow.com/questions/36570528/how-to-specify-fixed-width-to-chart-bars
‘For horizontal bar charts, fix the y-scale minimum and maximum
‘For vertical bar charts, fix the x-scale minimum and maximum
Sub ChangeChartFormatting()
Dim cht As Chart
Set cht = ActiveSheet.ChartObjects("Chart 1").Chart
'Adjust y-axis Scale
cht.Axes(xlValue).MinimumScale = 40
cht.Axes(xlValue).MaximumScale = 100
'Adjust x-axis Scale
cht.Axes(xlCategory).MinimumScale = 1
cht.Axes(xlCategory).MaximumScale = 10
'Adjust Bar Gap
cht.ChartGroups(1).GapWidth = 60
'Format Font Size
cht.ChartArea.Format.TextFrame2.TextRange.Font.Size = 12
'Format Font Type
cht.ChartArea.Format.TextFrame2.TextRange.Font.Name = "Arial"
'Make Font Bold
cht.ChartArea.Format.TextFrame2.TextRange.Font.Bold = msoTrue
'Make Font Italicized
cht.ChartArea.Format.TextFrame2.TextRange.Font.Italic = msoTrue
End Sub