Possible to stop clearing the Excel clipboard when a macro runs?

mcomp72

Active Member
Joined
Aug 14, 2016
Messages
275
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2011
Platform
  1. Windows
  2. MacOS
On several of the sheets in my workbook, I have code that runs inside the Worksheet_SelectionChange sub. This is because I want the font color in column A to change based on what row the active cell is on. (If they active cell is in row 30, the font color in "A30" should change to red.)

Unfortunately, due to this code running every time the user selects a new cell, the clipboard is also cleared, so the user cannot do a copy/paste on the sheets. They can select Copy (or Ctrl-C), but once they move to the cell where they want to paste, the marching ants disappear and the clipboard seems to be cleared. Is there any work-around for this? I would like my users to still be able to copy & paste, but so far the only way I can see to do this is to remove the sub Worksheet_SelectionChange.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
It would be helpful to see your code.
 
Upvote 0
I'm confused. I thought the Excel clipboard was cleared every time a macro ran. If that's true, I don't understand how seeing my specific code would make any difference.

Is it not always the case that the clipboard is cleared whenever a macro runs?
 
Upvote 0
If that is correct, then I apologize, I have never heard that before. In that same line of thought, if that is true, there may be code to be written that will save the contents of the clipboard prior to deletion and then write the contents back to the clipboard.

Either way, your choice. I am learning everyday. Perhaps one of our more knowledgeable members will respond with what really happens to the contents of the clipboard when a code is run.
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,454
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top