Oct 16 2022 11:11 AM
I have a macro to create a function that gives the sum of values with particular cell color in a selected range of columns. For that macro to run whenever the cell color is changed in the range of columns, I added the following code to the sheet, but that is not allowing me to copy-paste one cell to another within the range of columns - G:K. Please advise.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("G:K")) Is Nothing Then
ActiveSheet.Calculate
End If
End Sub
Oct 17 2022 05:16 AM
@Vishal88 Change your code like this:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = xlCopy Or Application.CutCopyMode = xlCut Then Exit Sub
If Not Intersect(Target, Range("G:K")) Is Nothing Then
ActiveSheet.Calculate
End If
End Sub