Button on Toolbar to AutoFit both Column Width and Row Height

UncleBocky

New Member
Joined
Sep 9, 2009
Messages
2
Is there a way I can add a button to my toolbar so that when pushed the selection will have it's row height autofitted and the column width autofitted? I paste a lot of data from Access and don't want to have to go through the trouble of selecting all the columns, changing the width, then double clicking in between the columns and rows to get it autofitted.

I know a macro could be created, but I want to be able to use this button on any workbook I open up and without having a macro listed in every workbook I create.

I am using Excel 2003.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I use a similar approach with the following (I have it linked to a keyboard shortcut). This will applyt o an entire worksheet.

Sub Format()
'
' Format Macro
'
'
' Keyboard Shortcut: Ctrl+q
'
Cells.Select
With Selection
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Columns.AutoFit
Range("A2").Select
End Sub
 
Upvote 0
The simplest thing to do would be to save it in your personal macro
workbook.

If you have not created one already, then record a new macro and chose the
drop down store in 'Personal Macro Workbook'

A new workbook is created (default called Personal.xls), in the autoopen
directory of Excel, when you open Excel this workbook is also opened yet it
is hidden. Macros in the workbook can be run from the visible workbook.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,431
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top