PC Review


Reply
 
 
Bishop
Guest
Posts: n/a
 
      28th Apr 2010
If I'm in an Excel spreadsheet I can click the button between column label A
and row label 1 to select the entire worksheet. Then I can double click in
between any column and all the columns will autofit to the best fit. How can
achieve this affect using VBA code?
 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      28th Apr 2010
This is exactly what you get when you use the macro recorder.

Sub fit()
Cells.Select
Selection.Columns.AutoFit
End Sub


Gord Dibben MS Excel MVP

On Tue, 27 Apr 2010 16:11:01 -0700, Bishop
<(E-Mail Removed)> wrote:

>If I'm in an Excel spreadsheet I can click the button between column label A
>and row label 1 to select the entire worksheet. Then I can double click in
>between any column and all the columns will autofit to the best fit. How can
>achieve this affect using VBA code?


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rows().AutoFit starts a calculation, but Columns().AutoFit doesn't Stefano Microsoft Excel Programming 1 30th Nov 2009 05:01 PM
RE: Rows().AutoFit starts a calculation, but Columns().AutoFit doesn't Mike H Microsoft Excel Programming 0 25th Nov 2009 04:31 PM
RE: Autofit (Columns.EntireColumn.AutoFit) does not work Kevin B Microsoft Excel Misc 0 10th Feb 2009 05:21 PM
RE: Autofit (Columns.EntireColumn.AutoFit) does not work Kevin B Microsoft Excel Misc 0 10th Feb 2009 05:14 PM
Autofit Row Chris Microsoft Excel Misc 3 26th May 2004 10:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 AM.