Finding word within a text string

Livin404

Active Member
Joined
Jan 7, 2019
Messages
460
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings, I have a word in Column F that if present I need another word to be placed in Column E. I have the formula for if it is just one word, but I need to change it slightly so if the word in at the beginning, end, or middle the word will still be detected. If located N/A will be placed in Column E. The following is perfect if "Post" is the only word in Column F; however I need the code to do a little more. Thank you,

VBA Code:
Sub NA_For_Seat_Release()
    Dim i As Long
    For i = 6 To ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
    Select Case ActiveSheet.Cells(i, 6).Value
    Case "POST"
ActiveSheet.Range("E" & i) = "N/A"
End Select
Next i
End Sub
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,252
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Sub NA_For_Seat_Release()
   Dim Cl As Range
   For Each Cl In ActiveSheet.Range("F6:F" & ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row)
      If Cl.Value Like "*POST*" Then Cl.Offset(, -1).Value = "N/A"
   Next Cl
End Sub
 
Solution

Livin404

Active Member
Joined
Jan 7, 2019
Messages
460
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Exactly what I needed, Thank you.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,252
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,141,068
Messages
5,704,092
Members
421,327
Latest member
Msh

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
Top