I have a piece of code that I am unaware of. I want the code to check if the Roomnum.Value is already in 6 cells, then a MsgBox will appear. So, for example, if they write the number 30 in the Roomnum textbox and it occurs in the range of "C6:E38" 6 times already, then the msgbox will show. This is the code I have, and it works, but not the way I want to obviously.

Private Sub Roomnum_AfterUpdate()
    If Roomnum.Value > 6 Then
        MsgBox "This number is shown 6 times already"
        Exit Sub
    End If
End Sub
This code works if you input a number over 6 then the msgbox will show. I am not sure how it should be written if the value occurs more than 6 times.