Re: excel
Re: excel
- Subject: Re: excel
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 19 Aug 2008 12:22:39 -0700
- Thread-topic: excel
Title: Re: excel
What version of Excel are you using? It works OK in Excel 2008 (v12.1.2), It could be there was a bug in Excel 2004 - I recall some to do with columns and rows.
I think this should work in 2004 as well as 2008 (but I can't test it myself in 2004 to check):
if {c, r} ≠ {0, 0} then
set cn to get offset of cl column offset 1
set value of cn to r
I.e. just replace the 'entire row' line with that 'get offset' line.
--
Paul Berkowitz
From: Script2 <email@hidden>
Date: Tue, 19 Aug 2008 15:11:02 -0400
To: Paul Berkowitz <email@hidden>
Subject: RE: excel
Hi Paul
I tried the script, but I get error message
set cn to column (c + 1) of (get entire row of cl)
set value of cn to r
Can’t set value of column “$b$3” of entire row of cell “$A$3” of used range of active sheet to 3
Please advice.
Ruby
-----Original Message-----
From: applescript-users-bounces+script2=email@hidden [mailto:applescript-users-bounces+script2=email@hidden] On Behalf Of Paul Berkowitz
Sent: Tuesday, August 19, 2008 2:15 PM
To: AppleScript-Users
Subject: Re: excel
You're 90% wrong, then.
"VBScript" is something available only on Windows for a very few applications. Outlook uses VB Script.
You're probably thinking of VBA (Visual Basic for Applications). That used to be available in Excel Mac, up to and including Excel 2004. It is no longer in the newest version, Excel 2008. However, AppleScript (which was always pretty good in Excel) was completely re-done for Excel 2004 and is also in Excel 2008. It does everything that VBA did. That's the way to go.
Simply by checking the AppleScript dictionary for Excel, you can see how big it is. There is also a Guide for Excel (and Word, and PPT) AppleScript on the Microsoft Mac website: <http://www.microsoft.com/mac/developers/default.mspx> The Excel 2004 Reference Guide will help also with 2008. (I believe they're preparing a new one, too.)
This will do what you're looking for (unfortunately, you can't use a 'whose' clause to get the 'first cell of used range of active sheet whose value is 3333', but the repeat loop works):
tell application "Microsoft Excel"
set ur to used range of active sheet
set cc to (count cells of ur)
set {c, r} to {0, 0}
repeat with i from 1 to cc
set cl to cell i of ur
if value of cl = 3333 then
set {c, r} to cl's {first column index, first row index}
exit repeat
end if
end repeat
if {c, r} ≠ {0, 0} then
set cn to column (c + 1) of (get entire row of cl)
set value of cn to r
else
beep
display dialog "There's no cell containing the number 3333"
end if
end tell
--
Paul Berkowitz
From: Joel Esler <email@hidden>
Date: Tue, 19 Aug 2008 12:39:00 -0400
To: Script2 <email@hidden>
Cc: AppleScript-Users <email@hidden>
Subject: Re: excel
I'm 90% positive that VBScript is in Excel on the Mac.
J
On Aug 19, 2008, at 12:22 PM, Script2 wrote:
Isn’t VBScript for PC only?
-----Original Message-----
From: Joel Esler [mailto:email@hidden]
Sent: Tuesday, August 19, 2008 12:10 PM
To: Script2
Cc: email@hidden
Subject: Re: excel
Can't you use vbscript to do this?
On Aug 19, 2008, at 12:07 PM, Script2 wrote:
I am trying to write a script for excel, any sites with good examples?
I have a file with numbers in first column
1111
2222
3333
4444
I want to search for a particular number, extract the row number the number
is found in and write info in same row and next column.
Also is there a software which I can use with Applescript to generate form
for users to fill-in and write filled-in data to an excel file?
Thanks in advance.
Ruby
_______________________________________________
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
--
Joel Esler
http://blog.joelesler.net
http://www.dearcupertino.com
[m]
--
Joel Esler
http://blog.joelesler.net
http://www.dearcupertino.com
[m]
_______________________________________________
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
_______________________________________________
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