Saher Naji
Board Regular
- Joined
- Dec 19, 2019
- Messages
- 76
- Office Version
- 2013
- Platform
- Windows
Hello,
I'm trying to use this code to change the background color of a cell to yellow when I press Ctrl+C and has it stay yellow. This should be applied to every cell I copy.
Thank you in advance.
I'm trying to use this code to change the background color of a cell to yellow when I press Ctrl+C and has it stay yellow. This should be applied to every cell I copy.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = xlCopy Then
Target.Interior.Color = RGB(255, 255, 0) ' Yellow color
Else
Target.Interior.Pattern = xlNone ' Reset the cell's fill color
End If
End Sub
Thank you in advance.