Re: Excel 2011: Select noncontiguous columns
Re: Excel 2011: Select noncontiguous columns
- Subject: Re: Excel 2011: Select noncontiguous columns
- From: Stan Cleveland <email@hidden>
- Date: Wed, 19 Oct 2011 12:28:16 -0700
On Oct 19, 2011, at 1:02 AM, Olivier Berquin wrote:
> I would like to select noncontiguous columns to change the « column width »
>
> Something like
> set myRange to range {column 6, column 8, column 11, column 14, column 17}
> set column width of myRange to 14
>
> Instead of:
> set column width of column 6 to 14
> set column width of column 8 to 14
> set column width of column 11 to 14
> set column width of column 14 to 14
> set column width of column 17 to 14
Hi Oli,
I see that you're referencing columns by index. If referencing by letter is okay (or you're willing to convert between index and letter), the following will work. To adjust columns F, H, and K though M:
set myRange to range "F:F,H:H,K:M"
set column width of myRange to 14
FWIW, Excel itself uses a more precise method of specifying ranges that includes the document and sheet names:
set myRange to range "[Workbook1]Sheet1!$F:$F,$H:$H,$K:$M"
I believe that the dollar signs in the above string are (1) optional and (2) have something to do with absolute referencing. I know almost nothing about absolute and relative referencing, but it doesn't seem to have kept me from writing usaful Excel scripts.
Sorry that I'm not more up-to-speed on specifying a range using column indexes!
HTH,
Stan C.
--
"Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away." -- Antoine de Saint-Exupéry
_______________________________________________
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