Omit the first word from a cell contain text
"Bruno Campanini" wrote in message
...
As far as more than 10000 cells is concerned, I think it would
be quicker and easier to do the job with VBA code.
It it is ok for you, please tell me if you want the result in a new
column or if you want the original column modified.
Ciao
Bruno
The following code does the job writing a new column:
================================
Sub FirstWordOnly()
Dim StartRange As Range, TargetRange As Range
Dim i, j As Long
' Definitions
' ------------------------------
Set StartRange = [Sheet2!A292]
Set TargetRange = [Sheet2!B292]
' ------------------------------
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
On Error GoTo ErrHandler
For Each i In Range(StartRange, StartRange.End(xlDown))
j = j + 1
TargetRange.Offset(j - 1, 0) = Left(i, InStr(1, i, " ") - 1)
Next
Exit_Sub:
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description & vbCrLf & _
"Procedu FirstWordOnly" & vbCrLf & _
ThisWorkbook.FullName
Resume Exit_Sub
End Sub
==============================
Ciao
Bruno
|