A QBR-Season Gift: PPT Macro for Table Resizing
Published: November 16, 2017
Author: Jesse Morris
So, QBR season has arrived once again and with it, PowerPoint decks. So. Many. PPT decks. One time-consuming task in every data-heavy presentation is making sure that every table is the same size, shape and placement on each slide.
Doing this by eye is error-prone, boring and causes excessive coffee consumption. Not doing it means that your presentations look messy and unfinished. This is where macros come in.
This document will give you a quick rundown on how to enable and use a macro in PPT that will allow you to resize multiple tables in your deck so that they have exactly the same size and placement on each slide. You’re welcome, PPT world.
First, here’s the code.
Macro Code
Sub Resize()
With ActiveWindow.Selection.ShapeRange
.Height = 2.78 * 72 //72 is the multiplier for the inch (this is a note, not part of the code)
.Width = 4.17 * 72
.Left = 0.78 * 72
.Top = 1.25 * 72
End With
End Sub
To start, you need to find the Height, Width, Left, and Top measurements of your perfect table so that you can adjust the measurements in your code. To do that, go to File>Options>Quick Access Toolbar and add Size and Position.
Once you’ve done that, go back to your slide, select your table, and click Size and Position in the Quick Access Toolbar. Write down the Height, Width, Horizontal, and Vertical values. These are the values you need to put into your code. If you have more than one table per page, you’ll create two macros: Left_Resize and Right_Resize
Now you create the macro! On your View tab, click Macros:
You’ll see this pop up. Name your Macro either Resize, if you only have one table, or Right_Resize if you have two. You can’t use spaces in macro names. Click create after you name it.
Now you see the Visual Basic editor come up. This is where you paste in your code and change the values.
Once you’ve pasted in the code for your first macro, simply X out of the small window and then the large one.
Go back to your Quick Access Toolbar option, and, under Macros, add your new Macro.
To use, click on a table, then click the Macro button on the toolbar. Your table will immediately resize and place itself in the spot you designated in the code.
Repeat as needed!