Not2ruthless
asked on
How to Check String in top row of active column
I am a new to VBA (fun!) and am trying to write code that determines if the top cell (on row 5) of the active column contains a specific string. e.g. "Sun". I understand how to use the intstr, but cannot figure out how to change the range/cell reference in the bracket to reflect a different column. Thanks for any advice at all!!!
If InStr(1, [b5], "Sun", vbTextCompare) > 0 Then
MsgBox "It is Sunday."
Else
MsgBox "It is not Sunday"
End If
If InStr(1, [b5], "Sun", vbTextCompare) > 0 Then
MsgBox "It is Sunday."
Else
MsgBox "It is not Sunday"
End If
I do not use VBA but I know you can use COLUMN() to retrieve the current column.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank you!