Re: Excel scripting question
Re: Excel scripting question
- Subject: Re: Excel scripting question
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 17 Nov 2002 10:12:50 -0800
On 11/17/02 9:46 AM, "email@hidden" <email@hidden> wrote:
>
A pre-emptive "thanks" to everyone who has taken the time to answer my
>
questions in the past.
>
This question concerns Microsoft Excel. How do I get a script to return the
>
number of the last row in a worksheet that has data entered into it? For
>
example, I have a worksheet with text entered into rows one through 44, and
>
nothing after that. I want a script to return "44" to me. I've tried several
>
things to no avail.
>
Two different ways I know of:
1. As long as your worksheets always start in row 1, this works fine:
count (Rows of UsedRange of ActiveSheet)
--> 44
UsedRange is you best friend in Excel.
If there's a chance that some rows at the top are blank (?), you'd need
instead:
set ur to UsedRange of ActiveSheet
(count (Rows of ur)) + (Row of ur) - 1
Row of a range gives the row number of the _first_ row in the range.
2. Or just go with:
Row of (get LastCell (UsedRange of ActiveSheet) Direction xlDown)
--> 44
--
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.