I am fairly new to VBA, and I'm trying to write a code that checks a column to see if it contains a specific number. For example, let's say I have cells A1:A15 filled out with random numbers 1-9. I want to write a code that looks at each cell and prints out a message box that says True if any of the cells contains the value of 1. This is what I've tried to come up with, but it doesn't work and I'm not sure why:
Sub Macro1()
'
' Macro1 Macro
'
If Range("A1:A15").Value = 1 Then
MsgBox "True"
End If
End Sub
I've also tried using ==1 just in case. It seems like it doesn't like using an = unless referring to a word. However, I'm still pretty new to VBA, so I'm not sure if my logic is correct. Any help would be highly appreciated.