Easy and Useful Macro: Right Fit Worksheet — Business Management Daily: Free Reports on Human Resources, Employment Law, Office Management, Office Communication, Office Technology and Small Business Tax Business Management Daily
If you’ve never created a Macro before, this one will be an easy starting place. A macro can be a simple recording of keystrokes that can be played back over and over again. The purpose of this macro is to set the column widths and row heights to the right size to accommodate the data their holding. Start with a worksheet where you’ve narrowed a few columns enough to show # signs in the cells. You may also want to select a few rows and make them either too wide or too narrow.
Columns too narrow, rows too tall and narrow.
Start on the View tab, in the Macro group and click the Macro button.
Select Record Macro Name it something easy, such as “RightFitSheet”.
Assign it a keyboard shortcut using your Shift key and a letter, like R for right fit. This way the shortcut will be Ctrl+Shift+R.
Change the “Store macro in…” field to Personal Macro Workbook. This way you can use it on any workbook.
Record macro dialog box
When you click OK, you will be recording your keystrokes. It’s always a good idea to take your hands off of keyboard and mouse at this point. You will want to be very intentional about what you do next.
Select the cornerstone on the worksheet to select all cells (Ctrl+A twice works well, too). Be sure that all cells remain selected during the next two steps.
Double-click between two column headers. Be sure your cursor is positioned between the two letters and appears as a horizontal double arrow.
Now, double-click between two row headers. Be sure your cursor is positioned between the two numbers and appears as a vertical double arrow.
Right size columns and rows
Press Ctrl+Home to place your cursor in cell A1. This step is optional, but it’s always good to know where your cursor is going to end up when your macro completes.