Home>Blogs>Charts and Visualization>Resize and Relocate the Chart using Excel Range
Resize and Relocate Chart
Charts and Visualization VBA

Resize and Relocate the Chart using Excel Range

In this article you will learn a trick to resize and relocate a chart using VBA. We have created a shortcut key Shift+Ctrl+R to resize and relocate active chart. You just need to select the range and your selected chart will be relocated and resized according to selected range. You can move the chart to another worksheet also.

Below is the VBA Code-

Sub Resize_Chart()

Dim cht As Chart

On Error Resume Next

    Set cht = ActiveChart

On Error GoTo 0

If cht Is Nothing Then

    MsgBox "Please select the chart"

    Exit Sub

End If

Dim rng As Range

Set rng = Application.InputBox("Please select the Range", "Range Selection", Type:=8)

'Chart Object is the parent of Chart

cht.Parent.Top = rng.Top

cht.Parent.Left = rng.Left

cht.Parent.Height = rng.Height

cht.Parent.Width = rng.Width

cht.Location xlLocationAsObject, rng.Parent.Name   'Worksheet name is the parent of range

End Sub


Just copy this code and paste in VBA Module. You add the shortcut key to run this macro. To add a shortcut key

  • Go to View Tab >>Macros>>View Macros>>
  • Select Resize Chart Macro and Click on Options button
  • Put capital “R” in shortcut key box.

Click here to download this Excel workbook.


Watch the step by step video tutorial:

Meet PK, the founder of PK-AnExcelExpert.com! With over 15 years of experience in Data Visualization, Excel Automation, and dashboard creation. PK is a Microsoft Certified Professional who has a passion for all things in Excel. PK loves to explore new and innovative ways to use Excel and is always eager to share his knowledge with others. With an eye for detail and a commitment to excellence, PK has become a go-to expert in the world of Excel. Whether you're looking to create stunning visualizations or streamline your workflow with automation, PK has the skills and expertise to help you succeed. Join the many satisfied clients who have benefited from PK's services and see how he can take your Excel skills to the next level!