Ask Your Question

Calc macro to display same section when switching sheets

asked 2019-02-02 19:00:55 +0200

baseplodder gravatar image

I would be grateful if someone could help me with a problem I have in Calc. After having scrolled down and across sheet #1 of my worksheet so that, for example, the cell AA50 is in the upper left-hand corner I want to click on the tab 'sheet #2' and make the corresponding cell (AA50) of sheet #2 be displayed at the upper left hand corner. In other words I want to be able to see the same section of a sheet when I change sheets - to make it appear as if they were synced to each other.

There does not seem to be any simple way of doing this, so I suppose I must write a macro that looks for the upper left hand corner of sheet #1 and then displays the same cell of sheet #2 in that position. This macro must then be attached to the sheet #2 tab. Having never written a macro for LO Calc I have no idea how to start. I would therefore be very thankful for any help from the community.

edit retag flag offensive close merge delete


Hi Ratsinger and Lupp. I have ticked Ratsinger's suggestion because it identifies my problem correctly with a 3D conception which I had not previously considered, but I am grateful to you Lupp for your alternative suggestion. You have both shown me a way forward. Thanks!

baseplodder gravatar imagebaseplodder ( 2019-02-03 11:41:42 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2019-02-02 19:40:50 +0200

Ratslinger gravatar image


If understood correctly, and this has nothing to do with actually copying or moving data itself, then this post -> How to scroll all libreoffice calc spreadsheet sheets together. (Or other ~3D-like ideas) contains macros and as tested seems to work as you requested.

edit flag offensive delete link more

answered 2019-02-02 22:35:12 +0200

Lupp gravatar image

updated 2019-02-02 22:36:46 +0200

I wasn't completely fond of the code from stackoverflow, and wouldn't like to make the "shifted selection" the default by intercepting the respective event.
Thus I made a macro to call via >Tools>Macros>Run or with the help of an additional text/icon placed in a toolbar.
This attachment is containing the macro. You may enhance it a bit for use with a toolbar area by introducing a parameter for the modifier keys skipping the InputBox e.g. under conditions, and using an offset of +1/-1 then.

(Of course I don't expect much usefulness. It was akind of finger exercise. I personally will mot use the tool.)

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-02-02 19:00:55 +0200

Seen: 21 times

Last updated: Feb 02