View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
just_jon
 
Posts: n/a
Default REPLACE or ??, Help please

You could use code. The below is set to use the current selection as
its target range, but you could use a static range or the entire used
range.

Sub TruncCells()
Dim c As Range, i As Integer
Application.ScreenUpdating = False
For Each c In Selection
If Not c.HasFormula Then
i = InStr(1, c.Value, "-")
If i 0 Then c.Value = Left(c.Value, i - 1)
End If
Next c
Application.ScreenUpdating = False
End Sub