Macro to expand cells in Calc

Good morning, I would like to create a command to expands the formulas in the row of a calc spreadsheet.
For example, if I write “10” in a specific cell, I want that the formula in another cell will be copied in the 10 rows under it.
The same with graphs: Using the same command I would like to expand the graph range.
I know I can use the macro, but how?

Hello,

it should be easy to write a macro which executes on the currently selected cell, but you’ll have to specify how the cell containing the formula is connected (aka. relates to ) the cell containing the “10” value.

Do you always want to copy the same formula?
Or is the formula always at a certain position on the sheet.

If you can, attach a small example ods with some manually added data.

Later.