Macro to fill all selected cells

I am working on a calendar for my work, the idea is to make it easy to use, for this reason I am creating buttons to fill in the boxes.
I have managed to use it for cells individually but I would need to know how I can do that with a macro, applied to a button, to write the same text in all the selected cells.

Have you tried the Fill feature? (Without any macros.)


copy <ctrl><c> (one cell) … and paste <ctrl><v> (multiple selections)

1 Like

The person who will use this template is someone who has trouble to finding the power on of the computer. My idea of creating a button with this function, is to make it as simple as possible. Without using keyboard shortcuts.

I don’t understand the intentions of the questioner.

Since there can be cases where spreading a cell content over selected ranges is reasonable, and may require custom code, I made an example. It supports distinction concerning the type of content created in the target ranges.
The code for the strongest variant (including any formatting) is short, but both variants of the final solutions make use of two functions from one of my toolboxes. These are included in the module ‘helper’.
disask84868spreadContentToManyCells.ods (22.1 KB)