Formatting the Chart

Two formatting options we can add are for the plot area (the area behind the lines and markers), and the corners of the chart. To set a colour for the plot area, the code is this (single line):

.PlotArea.Format.Fill.ForeColor.RGB = RGB(255, 255, 200)

Again, we have an RGB value after the equal sign. Before the equal sign, we have this:

PlotArea.Format.Fill.ForeColor.RGB

This is self-explanatory: you're formatting the foreground fill colour of the plot area.

To set rounded corners for your chart, the code is this:

ChartArea.RoundedCorners = True

Here's the adapted With Statement. Change your code to match:

You can run your programme, now. Click Run > Run Sub/User Form from the menu at the top of the Visual Basic window, or press F5 on your keyboard. You should see a Scatter Lines chart appear on your spreadsheet. (You can add a button to your spreadsheet, if you want. Then attached the Sub when you see the dialogue box appear.)