Re: How to add a "tab" in Excel
Re: How to add a "tab" in Excel
- Subject: Re: How to add a "tab" in Excel
- From: David Wignall <email@hidden>
- Date: Thu, 12 Feb 2004 19:55:58 +1300
on 12/02/2004 6:19 PM, email@hidden at email@hidden wrote:
>
I am beginning to learn applescript and have just recorded my first script in
>
Excel. I am attempting to type text into adjacent cells. When I record the
>
script, it begins by selecting the "active cell". Then, when I tab to the next
>
cell to the right, the reference is to a specific cell in the spreadsheet, as
>
a
>
row and column, not as for instance "tab to the next cell to the right." How
>
do I program applescript to change to a cell relative to the first active
>
cell, rather than referring to an absolute position in the spreadsheet?
>
Eventually, I may want to navigate up or down, to the left or right of any
>
given cell
>
where I am working.
Two possibilities:
Select the (Offset RowOffset 1) of Range ("R1C1")
Using a variable and a loop we can have
repeat with theOffsetNumber from 0 to 9
Select the (Offset ColumnOffset theOffsetNumber) of Range ("R1C1")
set the Value of the ActiveCell to 42
end repeat
however you don't need to select the cell. More efficient is
repeat with theOffsetNumber from 0 to 9
set the Value of (Offset ColumnOffset theOffsetNumber) of Range ("R1C1")
to 42 -- 1 long line
end repeat
Alternatively you can work directly with the range reference thus
repeat with theColumnNumber from 1 to 10
set the Value of the Range ("R1C" & theColumnNumber) to 42
end repeat
Note that Offset may start from zero if you need to work with the 'anchor
cell.'
--
Dave
_______________________________________________
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.