OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Finding last row of a data set in range

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Krypton
General User
General User


Joined: 29 Mar 2007
Posts: 25

PostPosted: Sun Sep 21, 2008 5:10 am    Post subject: Finding last row of a data set in range Reply with quote

Hi all,

I am writing a macro to do a sort and delete of rows on a report. I can sort and delete rows OK, but I am having a problem finding how to get the last row of a particular data set in a range.

I have a column in a range with 3 different values, say, David, Peter and Paul I do a sort on this column and want to delete all the rows with Peter and Paul in them. I have the number of the last row of the complete data set, but can't figure out how to find the last row of the data set with David in them.

I could do a loop, but this would take too much time and the report has many rows.

Any help would be greatly appreciated.
_________________
www.sun.com
Back to top
View user's profile Send private message
Krypton
General User
General User


Joined: 29 Mar 2007
Posts: 25

PostPosted: Sun Sep 21, 2008 10:49 pm    Post subject: Reply with quote

Anyone?

Sad
_________________
www.sun.com
Back to top
View user's profile Send private message
Krypton
General User
General User


Joined: 29 Mar 2007
Posts: 25

PostPosted: Mon Sep 22, 2008 1:55 am    Post subject: Reply with quote

Panic over.

I used the match formula. One thing that annoys me is that I don't know how to access it without creating it in a cell, and then referencing that cells value. My code is as follows


Code:

oMatch = osheet.getcellrangebyName ("AL1")
oMatch.formula = "=MATCH(""Peter"";AK$1:AK$8440)"
oend = oLastCell.endrow - omatch.value

oSheet.getRows().removeByIndex(omatch.value, oend)

_________________
www.sun.com
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group