View Single Post
  #21   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove
 
Posts: n/a
Default Text manipulation

Bob Phillips wrote...
....
If nIndex = 1 Then
Cells(i, "A").Value = Right(Cells(i, "A").Value, _
Len(Cells(i, "A").Value) - 1)
Else
Cells(i, "A").Value = Left(Cells(i, "A").Value, nIndex - 1) & _
Right(Cells(i, "A").Value, Len(Cells(i, "A").Value) - nIndex)
End If

....

Could simplify: Right(x, Len(x) - y) == Mid(x, y + 1)

Then again, the whole If block could be replaced by

Cells(i, "A").Value = _
Application.WorksheetFunction.Replace(Cells(i, "A").Value, nIndex,
1, "")