View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Roman[_4_] Roman[_4_] is offline
external usenet poster
 
Posts: 93
Default Delete Part of Cell?

You need to place the three spaces into the tested string. Not " a-"
but " a-"

This should work for you:

For Each cell In Range("team1batting!A2:A25")
If cell.Value = "" Then Exit Sub
sStr = Trim(cell.Value)
If Left(sStr, 3) = " a-" Or Left(sStr, 3) = " b-" Then
cell.Value = Trim(Right(sStr, Len(sStr) - 5))
End If
Next