Re: Contents of an Excel cell
Re: Contents of an Excel cell
- Subject: Re: Contents of an Excel cell
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 17 Apr 2002 09:59:41 -0700
On 4/17/02 9:25 AM, "Christopher Coulon" <email@hidden> wrote:
>
I am scripting an Excel worksheet and need to test the contents of a cell to
>
stop a repeat loop, but I can't seem to find the AS expression to get the
>
contents of an given cell. Is there a line that will return the value of
>
"R3:C3" so that I can tell if its numeric value is greater than zero?
>
>
set myCell to contents of "R3:C3"
>
>
or
>
>
set myCell to value of "R3:C3"
>
>
don't work.
>
set myCell to Value of Cell "R3C3" of ActiveSheet
[no colon in name, and you have to specify the element type 'Cell']. It will
work without 'of ActiveSheet' too, but it's better to be unambiguous.
Be aware also that:
1) an empty cell returns value of 0
2) a cell with numeric value of 0 returns 0.0: numeric values are always
reals, not integers. So you'll have to check:
try
if myCell > 0.0 then
--whatever
end if
on error
beep -- or something else in case value is blank or string
end try
3) to SET the value of a cell to empty, you have to set it to "", not 0
!
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.