ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   click on one cell to find and highlight a related cell? (https://www.excelbanter.com/excel-discussion-misc-queries/156807-click-one-cell-find-highlight-related-cell.html)

justsomeguy

click on one cell to find and highlight a related cell?
 
is there a way to have i.e. a list of people's names in one column, and a
list of company regions in another column, so that whenever you click on a
person's name in the first column, Excel highlights that person's region in
the second column?

(so the user can find out any person's Region, by clicking on their name.)


Gary''s Student

click on one cell to find and highlight a related cell?
 
Place the following macro in the worksheet code area:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Range("B:B").ClearFormats
Target.Offset(0, 1).Interior.ColorIndex = 6
Application.EnableEvents = True
End Sub

If you select a cell in column B, then the equivalent cell in column B will
be hi-lighted.
--
Gary''s Student - gsnu200742


"JustSomeGuy" wrote:

is there a way to have i.e. a list of people's names in one column, and a
list of company regions in another column, so that whenever you click on a
person's name in the first column, Excel highlights that person's region in
the second column?

(so the user can find out any person's Region, by clicking on their name.)



All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com