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:
Is there a reasonable workaround for this? Is there a problem with the code?
Any advice would be greatly appreciated.
Thanks,
Cindy
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