How to populate a listbox with unique values from a range.

asked 2018-10-09 05:41:01 +0200

hvankampen gravatar image

I have a Calc spreadsheet (LibreOffice version 6.1.0.3, Windows 7) with a single worksheet. The worksheet comprises 8 columns and 2925 rows. Each column is a named range.

What I need to do is, via a macro, populate a listbox with the unique values of a range.

I posed a query here re this lag issue under the title "Deleting all values in a column is slow.", explaining my problem. I included 2 sample files.

Is there any way to copy unique values from a range either to an array and thence to a listbox or to a listbox directly, without having to use a filter to route the unique values to another location first?

As things stand, I can obtain the unique values via a filter, no problem.

Copying the values into the listbox is not a problem.

The problem is I need to clear the filter output location before the listbox is re-populated (i.e. if the data in the range is changed), which takes 4-5 seconds. LibreOffice user "JohnSUN" suggested this lag is due to the amount of data in some of the cells (see the comments in the above mentioned previous query).

Any help would be appreciated.

edit retag flag offensive close merge delete