View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Robert H Robert H is offline
external usenet poster
 
Posts: 113
Default Remove specific text from cell string

I used:

Sub FixTime()
Dim timeCell As Range

For Each timeCell In Selection
If Right(timeCell, 2) = "pm" Or Right(timeCell, 2) = "am" Then
timeCell.Value = Left(timeCell, Len(timeCell) - 4) & ":" & _
Mid(timeCell, Len(timeCell) - 3, 2) & " " & Right(timeCell, 2)
timeCell.NumberFormat = "hh:mm"
End If
Next
End Sub

and it worked perfect. Thaks Mike and all for posting.
V/R
Robert