Finding word within a text string

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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
 
Upvote 0
Solution

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,060
Latest member
mtsheetz

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