Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default AutoFit Selection

I the Format Column drop down is a choice called 'AutoFit Selection'. How
would you call this function from a macro? What I want to do is two fold. 1.
Start at a cell such as cell(4,5) and go to the right most cell with an
entry and resize each column as you pass over the cell. 2. Start at the
same example cell and go down the column find the longest cell and then
call the 'AutoFit Selection' to resize the column.


Thanks for explaining this feature.

Ray


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default AutoFit Selection

one way:

Range(Cells(4, 5), Cells(4, Columns.Count).End( _
xlToLeft)).EntireColumn.Autofit

By finding the first filled cell to the left of cell IV4, we avoid
the loop.


In article . net,
"Ray Batig" wrote:

I the Format Column drop down is a choice called 'AutoFit Selection'. How
would you call this function from a macro? What I want to do is two fold. 1.
Start at a cell such as cell(4,5) and go to the right most cell with an
entry and resize each column as you pass over the cell. 2. Start at the
same example cell and go down the column find the longest cell and then
call the 'AutoFit Selection' to resize the column.


Thanks for explaining this feature.

Ray


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
Autofit (Columns.EntireColumn.AutoFit) does not work Michiel via OfficeKB.com Excel Discussion (Misc queries) 3 February 10th 09 05:29 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
format:column width: autofit selection dutch3dsmax Setting up and Configuration of Excel 1 March 28th 07 08:27 AM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"