troubleshooting Question

Using vba and "IF THEN" statements to see if cells contain a string

Avatar of tiehaze
tiehaze asked on
Visual Basic Classic
1 Comment1 Solution175 ViewsLast Modified:
Here is a simplified version of what I am working on.  I need to see if a cell contains "Federal Home Loan" within the text string. Below is the only way I know how to do it, which won't work because it won't always be exactly "Federal Home Loan Bank" (i.e. "Federal Home Loan Bank IL" or "Federal Home Loan Bank, TX"). Any help would be appreciated greatly.

Dim r As Range
Set r = Range("A1")
Do Until r.Value = ""
    If r.Offset(0, 3).Value = "Federal Home Loan Bank" Then
          'Execute Code A
    End If
    Set r = r.Offset(1, 0)
Loop

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros