Re: Need Excel AppleScript for Office 2004 for Macintosh
Re: Need Excel AppleScript for Office 2004 for Macintosh
- Subject: Re: Need Excel AppleScript for Office 2004 for Macintosh
- From: Doug McNutt <email@hidden>
- Date: Mon, 1 Oct 2007 16:03:39 -0600
At 16:59 -0400 10/1/07, Raymond P Reedy wrote:
>50 25 empty 35 49 empty 29 42 empty 45
>and A2 thru J2 like this...
>empty 38 empty 25 46 38 empty 40 16 30
>
>What I need to do with the script is make A1 thru J1 look like this...
>
>50 25 35 49 29 42 45 empty empty empty
>and A2 thru J2 like this...
>38 25 46 38 40 16 30 empty empty empty
Assuming. . . and we all know what that means . . that the numbers are all simple integers and not calculated formulas.
How about selecting the entire populated rectangle of cells and COPY.
Toggle to your favorite text editor, PASTE, and globally replace all multiple tab instances with a single tab. ( s/\t\t+/\t/gs ) in perl or BBEdit.
Select all, COPY.
Back to Excel, probably in a new page unless you have guts, select cell A1 and PASTE.
You might even persuade AppleScript to do the replacement itself but that would involve unicode and we have been talking about problems handling that. TextEdit.app should have what you need.
If you have formulas in the cells you'll have to be very careful to keep them pointed correctly and avoid #!REF errors. Excel's delete and shift cells left operation probably can make the required corrections to formulas. That will be slow if iterated over all of your data one cell at a time.
You can get a start at that by recording a VBA script that does just one delete operation. Building a loop through remaining cells won't be too difficult but care will be required because the cell identifications are changing as it proceeds. You probably should work from bottom right left and then up. The range object has row and cell methods you can use for getting at cells.
And - you did ask about AppleScript. I donno. My Excel doesn't do that at all - 2001.
--
--> From the U S of A, the only socialist country that refuses to admit it. <--
_______________________________________________
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