Making neat Excel charts (quickly)

If, like me, you spend a lot of time building spreadsheets with charts, you will want to make sure they are all lined up and neat.

This is how I do it. You can get this whole process done in seconds with a bit of practice :-).

  1. Select the range of cells that  you want your chart to cover.
  2. Name it “foo”. You can do that quickly with the keyboard shortcut Alt+i n d (so Alt+i, then ‘n’ and then ‘d’) which brings up the Name Range box.
  3. Use Alt+F11 to bring up your VBA window and select View->Immediate (or use Ctrl+G).
  4. Select the chart.
  5. Paste the following code into the immediate window:
    ActiveChart.Parent.Left = Range("foo").Left
    ActiveChart.Parent.Top = Range("foo").Top
    ActiveChart.Parent.Height = Range("foo").Height
    ActiveChart.Parent.Width = Range("foo").Width
  6. Run each line: put your cursor at the end of the first line and hit Enter to run each line by line.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s