Looks like you need to delete specified rows and I am afraid there is no good solution until the upcoming Origin 8, which has this new function designed exactly for this purpose:
/**
Parameters:
wksDest = [output] The Worksheet where the extracted data is copied onto, if unattached a new Worksheet is created.
vnRowIndices = [input] Row indices to extract, 0-offset
vnColIndices = [input] Column indices to extract data, if wksDest is the current worksheet, all columns not in this list will be deleted
Return:
TRUE if succesful FALSE otherwise
SeeAlso:
Worksheet::SelectRows
*/
BOOL Extract(Worksheet& wksDest, const vector<uint>& vnRowIndices, const vector<uint>& vnColIndices);
CP