• 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
Excel: hide multiple columns with Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Excel: hide multiple columns with Applescript


  • Subject: Excel: hide multiple columns with Applescript
  • From: Cameron Knowlton <email@hidden>
  • Date: Sat, 19 Mar 2011 11:04:33 -0700

I've been working more on my Excel scripting, and hope someone here can help with an efficiency.

Currently, I use a loop to hide excessive pivot table columns:

set pivotHideCount to (numberOfColumns - 5) -- number of columns to hide, beginning from the left (oldest)
repeat with pivotIndex from 1 to pivotHideCount
	set visible of pivot item pivotIndex of pivot field "Date" to 0
end repeat

Although this *does* work, it's extremely slow for large pivot tables. Unfortunately, I can't [figure out how to] address all the columns at once, e.g. (this doesn't work):

set visible of pivot items 1 through pivotHideCount of pivot field "Date" to 0

(e.g.:
set visible of (pivot items 1 through 15) of pivot field "Date" to 0
)
... it compiles, but when it runs, I get the error:

Microsoft Excel got an error: The object you are trying to access does not exist



Somebody suggested first selecting the columns, then setting the visible attribute of the selection, but I can't seem to figure out how to do it in Applescript. e.g. this also does not work (although it *does* compile, and even runs without complaint):

set visible of selected of pivot field "Date" to 0


This is likely an Applescript referencing technique that I don't know, more than an Excel issue. Anyone?

thanks guys,
Cam
--
Cameron Knowlton
KnowledgeVine SEO Dashboards
email@hidden
P: 250.382.0226
http://www.knowledgevine.net
 _______________________________________________
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

  • Follow-Ups:
    • Re: Excel: hide multiple columns with Applescript
      • From: David Wignall <email@hidden>
References: 
 >Re: Office 2011 and Applescript (From: Stan Cleveland <email@hidden>)
 >Re: Office 2011 and Applescript (From: Barry Wainwright <email@hidden>)
 >Re: Office 2011 and Applescript (From: Christian Prinoth <email@hidden>)
 >Re: Office 2011 and Applescript (From: Christian Prinoth <email@hidden>)

  • Prev by Date: Re: Office 2011 and Applescript
  • Next by Date: Re: Excel: hide multiple columns with Applescript
  • Previous by thread: Re: Office 2011 and Applescript
  • Next by thread: Re: Excel: hide multiple columns with Applescript
  • Index(es):
    • Date
    • Thread