Hello,
Not certain you thought out what all may happen. While it can be done using a macro, recording a macro is not going to help in this case. When recording a macro you would be dealing with a specific cell or cells. In your case it is random (that is, dependent upon the current selection).
Also what happens if you never actually paste what was copied or cancel the copy? If the background color is set when Ctrl+c is detected how do you reverse it if the operation is cancelled? What if you are copying to another Calc or other document? Still set background?
Just a lot of unanswered questions.
To actually set a background dependent upon a key combination can be done using a key handler to detect this combination. The attached sample demonstrates this but does not answer the previously mentioned questions. There are two items on a separate toolbar in this sample: sStartXKeyHandler
and xStopXKeyHandler
. By clicking on the start, Ctrl+c will place a yellow background in the selected cell(s). Selecting the stop tool will revert to no insertion of the background.
Sample ----- KeyHandlerSetBackgroundOnCopy.ods
Additionally, since you claim to know little on the subject of macros, it is best if you review the Macro sections in the LO documentation guides found here → Documentation/Publications
Edit:
While @jimk does present a valid method, it only displays further what I was attempting to explain. In both my above sample & the one by Jim K, if you use Ctrl + c in either case the cell background gets set even if the copy is cancelled. This is erroneous.
Have elaborated my code to only change the background color when Ctrl + v is used after Ctrl + c in the Calc document. So if something was copied elsewhere & Ctrl + v is used in Calc, nothing is highlighted. Likewise, there is no highlighted cell simply by pressing Ctrl + c.
Sample modified ----- KeyHandlerSetBackgroundOnCopy.ods - this now allows Enter
key to be used as well as the Ctrl + v for pasting.