Ask Your Question

Two Loops Together in Libreoffice Basic and Paste Function

asked 2016-08-23 11:19:31 +0100

Pedro Olazabal gravatar image

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?

image description

edit retag flag offensive close merge delete


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

JohnSUN gravatar imageJohnSUN ( 2016-08-23 14:29:27 +0100 )edit


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.

Pedro Olazabal gravatar imagePedro Olazabal ( 2016-08-24 11:08:08 +0100 )edit

3 Answers

Sort by » oldest newest most voted

answered 2016-08-23 15:53:38 +0100

mark_t gravatar image

updated 2016-08-24 16:15:03 +0100

Good introduction to macros is: 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.

edit flag offensive delete link more


Thanks a lot for answering

I will study the handbook you send me :)

Pedro Olazabal gravatar imagePedro Olazabal ( 2016-08-24 11:05:28 +0100 )edit


Pedro Olazabal gravatar imagePedro Olazabal ( 2016-08-25 13:30:21 +0100 )edit

answered 2016-08-24 11:54:14 +0100

Pedro Olazabal gravatar image

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

edit flag offensive delete link 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.

mark_t gravatar imagemark_t ( 2016-08-24 16:09:37 +0100 )edit

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

Pedro Olazabal gravatar imagePedro Olazabal ( 2016-08-25 13:27:17 +0100 )edit

answered 2016-08-23 15:55:09 +0100

JohnSUN gravatar image

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

edit flag offensive delete link more



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 :):):)

Pedro Olazabal gravatar imagePedro Olazabal ( 2016-08-24 11:25:22 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-08-23 11:19:31 +0100

Seen: 78 times

Last updated: Aug 24 '16