Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete part of cell value Sinner Excel Programming 2 May 26th 08 10:39 PM
Delete part of a cell Francis Excel Worksheet Functions 5 February 1st 08 07:58 PM
Delete Part of Cell? Odysseus[_8_] Excel Programming 2 November 1st 04 03:04 PM
Delete Part of Cell? Odysseus[_7_] Excel Programming 1 November 1st 04 02:46 PM
Delete Part of Cell? Odysseus[_6_] Excel Programming 2 November 1st 04 02:45 PM


All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"