Delete part of cell value

S

Sinner

Hi,

Below code removes word 'SADMIN' if found as part of a word or in each
cell of column M of
sheet2.
----------------------------------------------------------------------
Sub RMV_SADMIN()
Application.ScreenUpdating = False
Application.DisplayAlerts = False


For Each Cell In Range("sheet2!M:M")


sStr = Trim(Cell.Value)
If Left(sStr, 6) = "SADMIN" Then
Cell.Value = Trim(Right(sStr, Len(sStr) - 6))


End If


Next


Application.ScreenUpdating = True
Application.DisplayAlerts = True


Worksheets("Sheet2").Activate
Range("A1").Select


End Sub
 
D

dmoney

Columns("m:m").Select
Selection.Replace What:="SADMIN", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top