Ignore part of word in search

Moonbeam111

Board Regular
Joined
Sep 24, 2018
Messages
73
Office Version
  1. 365
  2. 2010
I have a macro in sheet2 that looks for a range in "S1:W30" and if its doesnt find any of those word in cell c3 of sheet2 then it alerts me. C3 of sheet2 always equals cell I21 of sheet 1. However, I have a word infront of I21 that I would like for it ignore, lets call that word "Boat". The cell in sheet I21 of sheet 1 always consists of two words and the first word is always boat. How can I have the word in Cell C3 of sheet2 be searched for but exclude the specific word "boat"? And also not put the word boat there when making them equal (see last line of code).

Here is what I have but I dont know how to ignore the first word of the two different words in sheet 1 C21.

VBA Code:
Dim f As Range
    Set f = Sheets("Sheet2").Range("S1:W30").Find(Range("I21"), , xlValues, xlWhole, , , False)
    If Not f Is Nothing Then
    Else: Msgbox "New Data Found!"
    Sheets("Sheet2).Range("C3") = Sheets("Sheet1").Range("I21")
    End If
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
maybe
VBA Code:
    Set f = Sheets("Sheet2").Range("S1:W30").Find(Range("I21"), , xlValues, xlWhole, , , False)
    If Not f Is Nothing Then
        Msgbox "New Data Found!"
        f = Mid(f,6)
        Sheets("Sheet2).Range("C3") = f
   End If
Unless I'm mistaken you don't need the Else. That assumes there is one space after Boat. If not, adjust 6 to whatever you need.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top