Find matches and highlight them

tvining

New Member
Joined
Jan 17, 2008
Messages
18
I would like to have a list of names in column C that when I click on them, would be highlighted in Column A and B.

A B C
1 1 1
2 3 2
5 2 3
4 4 4
3 5 5

So, when I go to Column C and click "3" then all the 3's in A or B are highlighted!

A B C
1 1 1
2 3 2
4 4 4
5 2 [3]<<CLICKED p HERE!<> selected this
3 5 5

Basically, it's a SCHEDULE. I want them to click their names, and see what day/shift they are working.

Tony
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try this. Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Range
If Target.Count > 1 Then Exit Sub
Me.UsedRange.Cells.Font.ColorIndex = xlAutomatic
For Each c In Me.UsedRange
    If c.Value = Target.Value Then c.Font.ColorIndex = 3
Next c
End Sub

then close the code window using the X.
 
Upvote 0
If you don't mind me being greedy, how can I change both the foreground and background at the same time?, so when I click a name it shows with black background, white text?

Might as well go for the gusto.

Thanks:LOL:
 
Upvote 0
Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Range
If Target.Count > 1 Then Exit Sub
With Me.UsedRange.Cells
    .Font.ColorIndex = xlAutomatic
    .Interior.ColorIndex = xlNone
End With
For Each c In Me.UsedRange
    If c.Value = Target.Value Then
        c.Font.ColorIndex = 2
        c.Interior.ColorIndex = 1
    End If
Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,026
Members
449,061
Latest member
TheRealJoaquin

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