1) Copy this code.
2) Right-Click the sheet tab of interest.
3) Select "View Code"
4) Paste the code into the window that appears.
5) Save the file as a macro-enabled .xlsm file.
6) Choose which message box you prefer
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
Dim strM As String
Dim i As Integer
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
i = Application.CountIf(Target.EntireColumn, Target)
If i = 1 Then Exit Sub
Set c = Target.EntireColumn.Find(Target.Value, Target.EntireColumn.Cells(1))
strM = "Value is in row" & IIf(i > 2, "s ", " ") & c.Row
Set c = Target.EntireColumn.FindNext(c)
While c.Address <> Target.Address
strM = strM & ", " & c.Row
Set c = Target.EntireColumn.FindNext(c)
Wend
'optional code
If MsgBox(strM & Chr(10) & "Filter the column to show those rows only?", vbYesNo) = vbYes Then
Target.EntireColumn.AutoFilter Field:=1, Criteria1:="=" & Target.Value
End If
'or just use
MsgBox strM
End Sub
Bookmarks