• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Excel Tutorials

Microsoft Excel Tutorials

  • Home
  • Microsoft Excel Tutorials
  • Learn
    • Formulas
    • Power Query
    • Errors
    • Videos
    • Charts
    • Shortcuts
    • Pivot Tables
    • Macros
    • Basics
    • Analysis
  • 240+ Excel Shortcuts
  • Privacy Policy
You are here: Home / Macros / How to Use Macros in Excel to Auto-fit Rows
How to Use Macros in Excel to Auto-fit Rows

How to Use Macros in Excel to Auto-fit Rows

posted on July 23, 2019

Auto-fit Rows Using Excel Macros

Row heights sometimes really not look presentable so, if you are wondering to auto-fit all of your rows within simple ways then just do it by using Macros in your Excel. With macros it will be done by only one click.

Purpose of this tutorial: to learn how to Auto-fit all rows by using macros to fit to its contents in excel.

Before following the procedure of this tutorial make sure you have enabled the Excel’s Developer Tab.

Previously In macros: How to Use Macros in Excel to Auto-fit Columns

STEP 1: GO TO DEVELOPER> CODE> VISUAL BASIC> COPY/PASTE THE CODE BELOW > CLOSE THE WINDOW

Copy The Code Below;

Sub AutoFitAllRows()
Cells.Select

‘See the magic happen!
Cells.EntireRow.AutoFit
End Sub

Auto-fit Rows

STEP2. Now test it in your excel by doing this:

First, open the sheet that contains the data and then

Go to Developer > Code > Macros > Run

Auto-fit Rows

Now all of the rows automatically get fitted just after clicking Run.

Filed Under: Macros Tagged With: Auto-fit Rows, autofit rows, excel macros, Macros

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Download 240+ Shortcuts

Microsoft Excel comes with varieties of keyboard shortcuts which are stated below with excel shortcut name and its keys for Windows and Mac.

Categories

  • Basics
  • Formulas
  • Pivot Tables
  • Charts
  • Power BI
  • Analysis
  • Shortcuts
  • Macros
  • Add-Ins

Recent Comments

  • Olivia on Convert Formulas to Values in Excel
  • Pkv on How to Insert Comment In Power Query Steps?
  • Rahul on How to Insert Comment In Power Query Steps?
  • David on How to Insert Comment In Power Query Steps?
  • sofia on How to use Workday Formula in Excel?

Footer CTA

Get Weekly Updates in your mailbox

Get Started Now

Copyright © 2021