run event code that highlights values but also the highlighting is mimicked in another range

40 Views Asked by At

I am attaching a link

https://www.dropbox.com/s/b5m53erinmcj6ys/EXAMPLE.xlsm?dl=0

to view the file I have. Currently when selecting a combination on the column A it will highlight in the range to the right, H5 to L27 the number that makes up the combination.

So my question is how can I mirror or mimic in the range to the right of the first range H5 to L27, meaning the cells that get highlighted in the first range get highlighted in the same cells in the second range Q5 to U27. right now it doesn't matter the data in the second range, as the second range is just mimicking the first range of cells be highlighted in yellow.

(the first one is done to show what it should be doing)

the code I have so far is this for mimicking one cell from one range to the other but am stuck and can't make it work to mimic all five cells at a time. here is the code,

[Private Sub Worksheet_SelectionChange(ByVal Target As Range)    With Target
    If .Cells.Count = 1 Then
        If Not Application.Intersect(Target, Range("H:L")) Is Nothing Then
            Application.EnableEvents = False
            Application.Union(.Cells(1, 1), .Offset(0, 9)).Select
            Application.EnableEvents = True
        End If
        If Not Application.Intersect(Target, Range("Q:V")) Is Nothing Then
            Application.EnableEvents = False
            Application.Union(.Cells(1, 1), .Offset(0, -9)).Select
            Application.EnableEvents = True
        End If
        If Not Application.Intersect(Target, Range("Z:AD")) Is Nothing Then
            Application.EnableEvents = False
            Application.Union(.Cells(1, 1), .Offset(0, -9)).Select
            Application.EnableEvents = True




   End If
End If
End With

End Sub]

Any help on this is greatly appreciated! Sincerely Dennis

0

There are 0 best solutions below