Any workaround for effect of Worksheet_SelectionChange on manual copy/paste?

Cindy Ellis

MrExcel MVP
Joined
Jun 9, 2006
Messages
1,802
I've been trying out some code modified slightly from what was posted recently on this forum, and it seemed to do exactly what I wanted it to do...it highlights the row that the user has selected to make it simpler to follow a give row all the way across a huge worksheet (columns A:DD are populated, mostly with a bunch of X's). Unfortunately, copy and paste no longer work...the "copy from" range is essentially released by the conditional formatting that is applied when the macro runs.
Here's the code for reference:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim IColor As Integer
        On Error Resume Next
        IColor = Target.Interior.ColorIndex
        If IColor <= 0 Then
            IColor = 36
        Else
            IColor = IColor + 1
        End If
        If IColor = Target.Font.ColorIndex Then IColor = IColor + 1
        Cells.FormatConditions.Delete
        With Range("A" & Target.Row, "DD" & Target.Row)
            .FormatConditions.Add Type:=2, Formula1:="TRUE"
            .FormatConditions(1).Interior.ColorIndex = IColor
        End With
End Sub

Is there a reasonable workaround for this? Is there a problem with the code?
Any advice would be greatly appreciated.
Thanks,
Cindy
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,214,951
Messages
6,122,449
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