Link to home
Create AccountLog in
Avatar of Not2ruthless
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
Avatar of jimyX
jimyX

I do not use VBA but I know you can use COLUMN() to retrieve the current column.
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Not2ruthless

ASKER

Thank you!