Hi,

I would like to develop an xy-graph consisting of coloured rectangles close to each other.

The basic data are:

Label   x       y      x_cumulative
A        10      5      10
B        35      3      45
C        20      8      65
D        15      4      80
E        20      9     100
The x-values represent per cent and the cumulative sum equals 100. The x_cumulative values represent the x-axis in the graph.
y and x_cumulative values make up the rectangles, in this case 5.
The rectangles are labelled inside the box and would have different colours.
The graph should have a secondary y-axis with the same appearance as the primary y-axis.

I started the programming but came only a small bit.

Sub MakeRectangle()
'
    Dim myRange As Range
    Dim myChart As Chart
    Dim myPoint As Point
    Dim myData As Range
    Dim mySeries As Series
    
    ActiveSheet.Select
    Cells.Item(1, 1).Select
    
    Set myRange = ActiveCell.CurrentRegion
    Set myRange = Intersect(myRange, myRange.Offset(1, 1))
    Set myChart = ActiveSheet.ChartObjects.Add(100, 50, 300, 150).Chart


End Sub
Kind regards,

Jan