View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default find text in cell and replace it with part of the text in that ce.

This version will retain only the first part:

Sub reward()
Dim s As String
s = "Rewardsmax_dining"
For Each r In Selection
If InStr(r.Value, s) < 0 Then
r.Value = s
End If
Next
End Sub

--
Gary''s Student - gsnu200718


"jules" wrote:

I have data in a cell eg Rewardsmax_dining_729x90_BUSFIN
I want to strip out the _729x90_BUSFIN.

How do I find and replace the contents of this column so that the only text
I keep is

Rewardsmax_dining

each cell in the column has Rewardsmax but each cell has unique text
associated with it. I need to strip out anything now Rewardsmax_dining