fishandtril
New Member
- Joined
- Nov 15, 2022
- Messages
- 15
- Office Version
- 365
- 2021
- Platform
- Windows
Hello
I am trying to write a macro that will look at data in a specifc worksheet and range and present a message box if the outcome is TRUE
I have data that is deemed "valid" or "invalid" depending on the data.
I want to remove the msb box if the "invalid" is contained in the range and nothing else needs to be done.
Here is my code:
I am trying to write a macro that will look at data in a specifc worksheet and range and present a message box if the outcome is TRUE
I have data that is deemed "valid" or "invalid" depending on the data.
I want to remove the msb box if the "invalid" is contained in the range and nothing else needs to be done.
Here is my code:
VBA Code:
Sub Test()
Dim FoundRange As Range
Dim SearchTerm As String
'Look for something
SearchTerm = "Invalid"
Set FoundRange = Worksheets("WWC").Range("H:H").Find(What:=SearchTerm)
'If found
If Not FoundRange Is Nothing Then
MsgBox "'" & SearchTerm & "' not found"
Else
MsgBox "'" & SearchTerm & "' found"
End If
End Sub