# 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?

edit retag close merge delete

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

( 2016-08-23 14:29:27 +0200 )edit

Hi

thanks a lot for answering! :)

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

( 2016-08-24 11:08:08 +0200 )edit

Sort by » oldest newest most voted

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.

more

I will study the handbook you send me :)

( 2016-08-24 11:05:28 +0200 )edit

yuhuuuuuuuuuuuuu!!!!!!!

( 2016-08-25 13:30:21 +0200 )edit

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

Another example

more

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.

( 2016-08-24 16:09:37 +0200 )edit

Yeah! Thanks a lot!!!!!!! That's what I needed :) :) :) :) :)

( 2016-08-25 13:27:17 +0200 )edit

I think you mean something like this - C:\fakepath\Two Loops.ods

more

Hi

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

( 2016-08-24 11:25:22 +0200 )edit