Hi,
I have a dropdown list in cell B11 in sheet1 where I can select values from column A in sheet2.
Everything works okay, but I would like to have a quality routine that alerts me if the selected value in B11 exists more than once in column A in sheet2. That is, because this value is used several places in this sheet with lookup-function, and it only returns the first values content.
So, this is my code:
Does anyone got a suggestion on code to use to search through column A in sheet 2 to see if the selected value exists more than once?
I have a dropdown list in cell B11 in sheet1 where I can select values from column A in sheet2.
Everything works okay, but I would like to have a quality routine that alerts me if the selected value in B11 exists more than once in column A in sheet2. That is, because this value is used several places in this sheet with lookup-function, and it only returns the first values content.
So, this is my code:
Code:
Public Sub Worksheet_Change2(ByVal Target As Range, Cancel As Boolean)Application.ScreenUpdating = False
Dim KeyCells As Range
Set KeyCells = Range("B11:D11")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
MsgBox "Det eksisterer minst to punkt med navnet" & Target.Address & " . Vennligst kontroller punktlisten!"
End If
End Sub
Does anyone got a suggestion on code to use to search through column A in sheet 2 to see if the selected value exists more than once?