Macro recorder essentially useless due to malfunctioning/inconsistent created macros?

Does anyone else wind up enduring the rather frustrating experience of trying to use the Macro Recorder only to find that running macros created by it only works on occasion?
For example I recently created a a macro using Macro Recorder which selects a range of cells then copy/pastes it into another position.

Upon running this macro (using a Push Button) the first time, it worked fine. But once I used it another time it copied the information to a completely separate location, writing over some essential (and fairly complicated) formulae in the process.
Now I have to go back and get the information that was lost via a saved Version, then copy the formulae over, all because the Macro Recorder doesn’t work properly.

What’s the point of this feature if it’s more trouble than it’s worth?
It’s worse to have a severely malfuntioning feature than it is to not have the feature at all!

EDIT: in the supplied document the number (11) in “Scores - R.R.D.T.” sheet is supposed to appear in cell C4, but when I ran the macro 3 times:

  1. It appears in C6 instead.
  2. It appears in the correct position
  3. it appears in J16 instead.

All other aspects of the macro (copy/pasting the range of cells (AK21:AR23, “Reading Development Tool” sheet) into H4:O6 “Scores - R.R.D.T.” sheet, and making the relevant cell background turn yellow (CK20, “Reading Development Tool” sheet) function as intended on each attempt (this time; in the past these other aspects have arbitrarily appeared in different positions as well).

The macro in question has been assigned to the Push Button titled “Grid Input 1” (CM20, “Reading Development Tool” sheet). Note: other buttons have old, irrelevant macros copied from the source file.

I wanted to upload a Screen Recording showing the process by which the macro was recorded, but video files aren’t accepted here… I’ve created a Dropbox folder containing Libreoffice-related screen recordings; anyone interested could send me their email info and I’ll invite them to view the folder.

Thanks.
Macro Problems.ods (143.3 KB)

the Code does what you recorded … nothing else!!
If you not able at minimum to read|understand recorded code you should not complain about.

which selects a range of cells then copy/pastes it into another position.

why not as usual with <ctrl><c> and <ctrl><v> instead of stupid buttons and stupid makros ??

It doesn’t do what was recorded each time, hence this entire question. I didn’t write this post for fun, you know!

If I run it at one time it will do what was recorded. Try again later, with absolutely no changes made, and it will play up and place data in the wrong position. It has done this numerous times over a long span of time, and in different documents also.

Perhaps I’m asking too much of the Macro recorder; the macros in question which aren’t working correctly are designed to copy the contents of a cell into the next sheet, then copy a selection of cells into a different position in the next sheet, all in the one macro.
What I can’t understand is why does it work sometimes but not others? Can’t be User error in this instance…

Not only does it occasionally malfunction and copy the data to an entirely different sheet, sometimes it places data in an incorrect position in the sheet it was instructed to place it in, and sometimes it only copies part of the data and not all i.e. not only is the macro behaviour inconsistent, the malfunctions present in a multitude of unpredictable ways!

The only User error I could come up with is that maybe I somehow switched sheet positions, but the fact that the Macros sometimes appear in the wrong position on the same sheet eliminates this as a possible explanation.

why not as usual with <ctrl><c> and <ctrl><v> instead of stupid buttons and stupid makros ??

A Macro is designed to shorten the amount of time taken to complete repetitive tasks by condensing each constituent step in the process into a one-step, easily executable process.
I don’t want to have to copy/paste the data manually the myriad times that is required, in turn taking a considerably longer amount of time than necessary, hence the use of a Macro… would have thought that fairly self-evident…

Okay, slow down and we’ll try to calmly analyze the reasons why what happened happened.
The first clarifying question - how did you choose the range of cells to copy and how did you specify the insertion point? Mind you, I’m not kidding by asking stupid questions - it’s really important.
The second clarifying question - can you demonstrate the code that the macro recorder generated? I understand that the text is very long, it makes no sense to publish it explicitly. It would be better if you attach a file with sample data and macro code to your question or one of the following comments.

1 Like

• Started recording
• Navigated to the first cell, selected and copied it,
• Navigated to the second page, pasted it,
• Navigated back to the first page, selected range of cells
• Navigated back to the second page, pasted it

Maybe all the page switching confuses the recorder? Why then would it sometimes work as intended but other times play up?

copy/pasting was performed using command c/v, if that matters at all. Navigating/selecting was done using the mouse.

Document in question contains sensitive data- if it didn’t then I would have uploaded it at the first instance.
Will tidy it up and upload whence I get a little more time over the next day or two

Recording a macro mentions, under the heading Limitations of the macro recorder

Selections are recorded only if they are done by using the keyboard (cursor traveling), but not when the mouse is used.

Perhaps this is a contributing factor.

2 Likes

It only can be happened if you deleted/inserted/renamed some sheets or you have deleted/inserted some rows/columns since the recording time. The macro system will not be informed about these changed state: the code will not be actualized to the changed state.

You must WRITE your macros based on the API functions and procedures (instead of recording them) - if you want to work with the macros efficiently.

For example when you use NAMED RANGES in your macros, then the inserted/deleted rows/columns (before/after the named range) will not cause problems. The macro recorder can not recognize the named ranges neither at the recording, nor at the running. You must write the macro code.
API: Application Programming Interface.

Otherwise the Macro Recorder has a very limited capability, and it works in the Calc and Writer applications only.
You can write API based macros for all of the applications, and you can control all of the functions and features what available by the User Interface.

1 Like

If you search help, post your code here.
.
If you think the code is altered without your consent, show both versions (new an reconstructed one from your backup).
.
Otherwise we can only give you some pity or tell “does not happen here”.

1 Like

Selections have been made just fine using the keyboard; the information has been copied successfully, and sometimes when the macro is used it functions correctly (see original edited question).

The problem is that the data appears in arbirarily different locations each time the macro is run, leaving me fairly perplexed as to the nature or cause of the problem…

In the macro code located in the attached sample file is missing a GoToCell “command” between the rows 30-33. The macro will jump to the Sheet 2, and then will paste the content of the clipboard.
Where it will paste it? There is not any GoToCell command. The macro will paste the clipboard content into the ACTUAL position of the cursor: where it leaved the cursor by YOU or by previuosly runned MACRO.
.
You have missed to record the detemining of the target cell.
.
It is reason why better to WRITE your macros instead of the recording them. You can fix the bugs without repeating the whole procedure for the recorder…

1 Like

I would put it a little differently: “The macro recorder skipped this part of the action, because the target range was selected not with the keyboard, but with the mouse”

2 Likes