A macro to count macros

I recorded a simple macro to copy/paste a cell or cells. Now I need to know how many times I used that macro in a spreadsheet and output that number in a cell. Is that even possible? I’d be happy to pay for the answer but so far I have not found a freelancer who is familiar enough with Libreoffice on Linux. (By the way, I use Libreoffice version is on a Linux Mint 20.1 desktop.) And no, I don’t want to use the windows version of libreoffice, it does not work as I need it.

It is not clear what caused your difficulties. If you can record a macro for copying cells, then it will not be difficult to add to the module five lines of the form

Sub countCalls
Dim oCell As Variant
	oCell = ThisComponent.getSheets().getByIndex(2).getCellByPosition(1,0)
	oCell.setValue(oCell.getValue() + 1)
End Sub

Now just before End Sub of your macro add a call to this procedure countCalls and get result in cell “Sheet3.B1”

Thank you JohnSUN
I’m sure you’re right, the problem is I don’t know how to “write” a macro. When I say I recorded a simple macro, I mean I turned on RecordMacro and did my cut/paste. I noticed that your suggested addition is nothing like my recorded program, and indeed the addition does not work. I think that writing vs recording a macro does not work the same way and, they are not interchangeable. Additionally, the recorded macro (which I’d like to attach but apparently cannot) will not work when I try to open the file in Windows version of Calc nor can I record a macro the same way in Windows Calc as in Linux Calc. If you’d be kind enough to indicate me how I can add your suggestions to my recorded macro I’d appreciate it.

You know, @Tamas Frecska , please download the book of Pitonyak. Just open the chapter 5.23.1. Copy Spreadsheet Cells With The Clipboard. You will be surprised, but it describes a macro that you recorded using a macro recorder (or something very similar). Don’t stop and look at the code in chapter 5.23.2. Copy Spreadsheet Cells Without The Clipboard - is shorter and more efficient. And with the explanations of Andrew Pitonyak - understandable. Just try

Thanks, will do. (It’s not that I’m lazy, just too damn old (-:slight_smile: