Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete part of cell value
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 ----------------------------------------------------------------- Any further improvement is welcomed. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete part of cell value
Columns("m:m").Select
Selection.Replace What:="SADMIN", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False "Sinner" wrote: 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 ----------------------------------------------------------------- Any further improvement is welcomed. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete part of cell value | Excel Programming | |||
Delete part of a cell | Excel Worksheet Functions | |||
Delete Part of Cell? | Excel Programming | |||
Delete Part of Cell? | Excel Programming | |||
Delete Part of Cell? | Excel Programming |