• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Auto Resize columns on opening a text file in Excel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto Resize columns on opening a text file in Excel


  • Subject: Re: Auto Resize columns on opening a text file in Excel
  • From: Paul Berkowitz <email@hidden>
  • Date: Wed, 07 Dec 2011 18:58:12 -0800
  • Thread-topic: Auto Resize columns on opening a text file in Excel

Title: Re: Auto Resize columns on opening a text file in Excel
On 12/7/11 6:27 PM, "Stan Cleveland" <email@hidden> wrote:

On Dec 7, 2011, at 6:10 PM, Spelean wrote:

I'm creating tab delimited text files from a database.
I'd like Excel to auto resize the columns to the max width in each column after opening.

This is akin to selecting all the columns manually and then double clicking the column divider in the header
 
Is there an inbuilt applescript command that will do this?

something like

        set column width of cell "A1:AD1" to (auto)  ?

Hi Andrew,

Assuming Excel 2004 or later, this should do the trick:
autofit columns of range "A1:AD1"

And for row height:
autofit rows of range "A1:A25"

HTH,
Stan C.

Yes, even better. You can again avoid even figuring out manually how many columns are being used with

tell application "Microsoft Excel"
   autofit (columns of used range of active sheet)
end tell

--
Paul Berkowitz
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Auto Resize columns on opening a text file in Excel (From: Stan Cleveland <email@hidden>)

  • Prev by Date: Re: Auto Resize columns on opening a text file in Excel
  • Next by Date: Random Signatures with Mail
  • Previous by thread: Re: Auto Resize columns on opening a text file in Excel
  • Next by thread: Re: Auto Resize columns on opening a text file in Excel
  • Index(es):
    • Date
    • Thread