#21073
LifeTimer
Participant

Thanks for your reply!

Unfortunately, this is not a solution for the problem. :-(

Even though it works when only rows at the very end of the file has been filtered away, it does not work if any other rows higher up in the document has been filtered away also.

Example:

Unfiltered document contents:

col1,col2,col3
1,2,3
aaa,bbb,ccc
aaa,bbb,ccc
11,22,33
111,222,333
xxx,yyy,zzz
xxx,yyy,zzz
xxx,yyy,zzz
xxx,yyy,zzz
xxx,yyy,zzz

After filtering the last rows (e.g. filtering away “xxx”):

col1,col2,col3
1,2,3
aaa,bbb,ccc
aaa,bbb,ccc
11,22,33
111,222,333

As mentioned above, the selection macro in my first post (modified with your suggestion of the eeGetLineView parameter to the document.GetLines() method) does indeed work now, BUT, if we also filter away some other lines, e.g. the ones containing “aaa”, we get the following visible document contents:

col1,col2,col3
1,2,3
11,22,33
111,222,333

And if we then try to run the macro, the selection is cut short and does not cover the full column (the last line is not selected, and the more lines we filter away, the more lines will not be selected at the bottom).

The problem is apparently that the SetActivePoint() method uses absolute line numbers (i.e. ignoring that rows have been filtered away), while the document.GetLines() method always returns a total count of lines (visible or not). So we would either need the SetActivePoint() method to also be able to use relative line numbers (i.e. after filtering), or need some completely other method to return the absolute line number of the last visible (non empty) line (for example named “document.GetLastVisibleLineNumber()”), in order to be able to perform this simple operation of selecting the contents of a column?

Here is the full macro code, modified with your suggested eeGetLineView parameter, for reference:

document.selection.SetActivePoint(eePosCell, document.selection.GetActivePointX(eePosCell), 2, false);
document.selection.SetActivePoint(eePosCell, document.selection.GetActivePointX(eePosCell), document.GetLines(eeGetLineView) - 1, true);