View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sinner Sinner is offline
external usenet poster
 
Posts: 142
Default Delete part of cell value

Hi,

Below code removes word 'SADMIN' if found 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
-----------------------------------------------------------------

Any further improvement is welcomed.