Disclosure: This post may contain affiliate links, meaning when you click the links and make a purchase, we receive a commission.

How to Align Shapes in Excel (5 Simple Methods)

In this tutorial, I am going to share with you 5 quick and simple methods to align shapes in excel. When we talk about aligning, there are many ways we can use to align shapes with respect to each other. Although you can do them manually one by one. But this will take a huge amount of time. In the following methods, you will learn how to use excel to auto-align shapes and save lots of your time.


Download Practice Workbook

You can download the practice workbook from here.


5 Simple Methods to Align Shapes in Excel

1. Align Shapes in Same Plane in Excel

In this first method, we have four shapes that are on the same plane. As you can see, they are not arranged in a particular way. Let us see how we can align them in simple steps.

Align Shapes in Same Plane in Excel

Steps:

  • First, click and select the top two shapes. You can use Ctrl to select multiple shapes.
  • Then, on top of your screen, go to the Shape Format tab.
  • Now, under this tab go to Arrange > Align and select Align Top.

Align Shapes in Same Plane in Excel

  • Consequently, the two shapes will align to the top.

Align Shapes in Same Plane in Excel

  • Next, select the two shapes on the left using the Ctrl key.
  • Here, in the same way as before, go to Shape Format > Arrange > Align and there select Align Left.

  • As a result, the two shapes you selected will align to the left.
  • Similarly, select the bottom two shapes and following the previous method apply Align Bottom.
  • Again, select the shapes on the right and apply Align Right command.

  • Finally, you should that all the shapes have aligned themselves just as we wanted.

Read More: How to Left Align in Excel (3 Handy Ways)


2. Switch Shapes Position in Excel between Front and Back

In excel, shapes can stay on multiple planes with respect to the user. In this dataset, we can see that the Blue shape is below the other two shapes. We can bring any shape to the front or send them to the back as we want. Follow the steps below to accomplish this.

how to align shapes in excel

Steps:

  • First of all, right-click on the Blue shape and select Bring to Front > Bring Forward.

how to align shapes in excel

  • Consequently, the Bring Forward command will bring the Blue shape above the Orange shape.

how to align shapes in excel

  • Again, right-click on the Blue shape and this time directly click on the Bring to Front option.

  • As a result, the Blue shape will align itself on top of all the other shapes.


3. Align Shapes in Excel Using the Snap to Shape Option

This third method is very simple and powerful to help us align shapes in an excel worksheet. Specifically, when we need to align shapes with each other. Let us jump right into this method.

Steps:

  • To begin with, select any of the shapes and go to Shape Format > Arrange > Align.
  • Here, select the Snap to Shape option.
  • Now, if you move any shape to reposition it, excel will help you to align it automatically with the nearby shape.

Align Shapes in Excel Using the Snap to Shape Option

  • Therefore, you can now move around the shapes and align them easily with respect to other shapes.

Read More: How to Change Alignment to the Right in Excel (5 Quick Methods)


Similar Readings


4. Using Excel Snap to Grid Option to Align Shapes

We can this method to snap shapes to the excel grid. Moreover, aligning the shapes to the grid in excel makes them more visually presentable.

Steps:

  • To start with, select any shape and go to Shape Format > Arrange > Align.
  • Then, select the Snap to Grid option.

Using Excel Snap to Grid Option to Align Shapes

  • Next, turn on your Gridline if you do not have them on currently.
  • Finally, select any shape and move it around. Excel will automatically try to snap the shape with the nearest grid line.


5. Applying VBA Code to Align Shapes in Excel

We can write some simple VBA code to quickly align our shapes in Excel. Also, VBA codes are reusable. So we can use them as many times as we want. Let us see how we can create and apply VBA codes.

5.1 Align Vertically

The first VBA code will align shapes in Excel vertically. But before this, you should customize your Ribbon and activate the Developer tab.

Steps:

  • First, select the shapes you want to align and go to the Developer tab.
  • There, select the Visual Basic option.

Applying VBA Code to Align Shapes in Excel

  • Now, in the new window, right-click on any of the sheets and go to Insert > Module.
  • Then, you will see a new module with the name Module1.

Applying VBA Code to Align Shapes in Excel

  • Next, double click on Module1, and in the new window type in the following code.
Sub AutoAlign_Shapes_to_Vertical()
'Automate the spacing and alignment of shapes
Dim sh As Shape
Dim lnCt As Long
Dim dTp As Double
Dim dLft As Double
Dim dHght As Double
Const dSpc As Double = 8
'Verify that shapes are chosen.
If TypeName(Selection) = "Range" Then
MsgBox "Please select the shapes to align."
Exit Sub
End If
'Define variables
lnCt = 1
'Loop through shapes
For Each sh In Selection.ShapeRange
With sh
'If it is not the first shape, slide it below the previous shape and align it to the left.
If lnCt > 1 Then
.Top = dTp + dHght + dSpc
.Left = dLft
End If
' To move the following shape in the collection, save the shape's characteristics.
dTp = .Top
dLft = .Left
dHght = .Height
End With
'Add a shape counter.
lnCt = lnCt + 1
Next sh
End Sub
  • Here, press Ctrl + S to save the module code.
  • Finally, while you have the two shapes selected, press the Run button.
  • Additionally, you can use the shortcut key F5 to run the code.

  • Immediately, the VBA code will align the two shapes vertically.


5.2 Align Horizontally

This method is similar to the previous one in that it uses the VBA code. But we need to modify our previous code to align shapes in Excel in a horizontal direction. Let me show you how to do that.

Steps:

  • First of all, select the two shapes you want to align.
  • Second, go to the Developer tab as I showed earlier, and select Visual Basic.

Applying VBA Code to Align Shapes in Excel

  • After that, Insert another module in the new window.
  • Note that, this module will have its name as Module2.

Applying VBA Code to Align Shapes in Excel

  • Then, double-click on Module2 and type the following code.
Sub AutoAlign_Shapes_Horizontally()
'Automate aligning shapes
Dim sh As Shape
Dim lCt As Long
Dim dTp As Double
Dim dLft As Double
Dim dWid As Double
Const dSpc As Double = 8 'Space between shapes (points)
'Check shapes selection
If TypeName(Selection) = "Range" Then
MsgBox "Please select shapes before starting."
Exit Sub
End If
'Variables value
lCt = 1
'Loop through selected shapes
For Each sh In Selection.ShapeRange
With sh
'If the selected is not first shape, move to right and align top.
If lCt > 1 Then
.Top = dTp
.Left = dLft + dWid + dSpc
End If
'Store properties of shape.
dTp = .Top
dLft = .Left
dWid = .Width
End With
'Increase shape counter.
lCt = lCt + 1
Next sh
End Sub
  • Next, press Ctrl + S to save the code to this module.

  • Finally, press the Run option and this will align the two shapes horizontally.

Read More: How to Apply Center Horizontal Alignment in Excel (3 Quick Tricks)


Conclusion

I hope that you find the methods I showed in this tutorial very helpful. These methods are simple and effective. Thus you can choose a method that suits your own case. In addition, I would encourage you to use the VBA codes and try to modify them further to use them for other types of aligning. And lastly, to learn more Excel techniques, follow our ExcelDemy website. If you have any queries, please let me know in the comments.


Related Articles

Nazmul Hossain Shovon

Nazmul Hossain Shovon

Hello, I am Nazmul Hossain. I am currently working full-time in Exceldemy as an Excel & VBA Content Developer. I have completed my bachelors in Naval Architecture and Marine Engineering from Bangladesh University of Engineering and Technology. I am interested in working with MS Excel. I also like coding web applications a lot.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo