Two Loops Together in Libreoffice Basic and Paste Function

Hi,
I have a task that I don’t know how to solve
I have two columns. In the first column I will have data like the following

Peter
George
John
Lewis
[Blank]
John
George
[Blank]
George
Lewis

The second column is in the beginning empty.
I want that the second column will be filled with the same data as the first column but without repeating names and without blanks.
The result of the second column would be

Peter
George
John
Lewis

I would make a programm like the following one (see image) but I don’t know some functions I need
1.How to check if a cell is empty → in calc the function isblank()

2.How to paste a cell in a new cellposition

On the other hand, I’m a beginner in programming so I would appreciate if you see some mistakes to correct

ps: is there any handbook for beginners in programming in libreoffice basic?

What does the [Blank] in your example? Word [Blank] or several spaces?

Hi

thanks a lot for answering! :slight_smile:

I wanted to edit the question with a screen shot with what I mean. But I don’t see how I can edit it :frowning:
I mean with blank that for example A3 is an empty cell in the initial column.

Good introduction to macros is:
OpenOffice.org Macros Explained
OOME Third Edition

To check a cell is blank you could use:

If MyCellConcatenate.String = "" Then

Note that MyCellConcatenate is an object so you need to specify the property that you want to test.

Edit:
It’s possible to achieve what you show in your example without using a macro.

Untitled 13.ods

Column E and F are helper columns.
Column E shows the name from Column A only if it is unique in the remainder of the table.
Column F lists the row of the next cell that contains a name in column E

Then your result column takes the name from Column A chosen by the row in F.

Thanks a lot for answering

I will study the handbook you send me :slight_smile:

yuhuuuuuuuuuuuuu!!!

I think you mean something like this - Two Loops.ods

Hi

Thanks a lot for the programm :slight_smile: :slight_smile: :slight_smile:
I’m trying to understand this but I’m not so good. I’ll respond you in a few hours :):):slight_smile:

Since I don’t see where I can edit my original question, I add a screen shot here with what I mean with the columns

image description

Another example

image description

This makes it clear what you are trying to do. It’s possible to do this without macros, I’ll update my answer and post example.

Yeah!
Thanks a lot!!!
That’s what I needed :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: