# How to Record a Macro in Calc That Select the Cell to The Left?

I am trying to record a macro in Calc that selects the cell to the left of the button, shifts up to two cells further to the left, applies the overwritten landing to the letters, and changes the font color. Everything works fine, the problem is that if I apply the same macro to another button it changes the cells of the previous button. That is, you would have to record a different macro for each line. Is there a way around this and make Libreoffice understand that just follow the procedure with the cell immediately to the left of the cell where the button is?

edit retag close merge delete

Same question posted on OpenOffice forum

( 2019-08-02 01:55:30 +0200 )edit

Sort by » oldest newest most voted

Quoting @israeltandrade: "..., shifts up to two cells further to the left, applies the overwritten landing to the letters, and ..."
Don't understand. Will ignore this part.
Quoting @israeltandrade: "I am trying to record a macro in Calc..."
Why? You will need to rework a recorded macro to significant depth for such purposes anyway. Better develop it from scratch then. If unavoidable you can use the "slot machine" made for recorded macros also in fully written ones.

In pursuit of this question I experienced that the LibreOffice API actually is very unhandy concerning the task to get the Shape containing a FormControl, and this way to get the Anchor. In fact my solution relies on shifting through the DrawPage, and thus on a working implementation of EqualUnoObjects(). Concerning this function there is the pending bug tdf#125421. The function seems to work, however, for the purpose under diskussion here.

If somebody is actually interested in what I did this attached example should help though the code is rather rough. If it satisfies the OriginalQuestioner's expctations was not in my focus insofar.

No recording of such a macro possible as far as I can see.

more