FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,364
- Office Version
- 365
- 2016
- Platform
- Windows
mI have a column of names but only want to retain the first name. I've tried using this evaluate in VBA, but it keeps giving me a #VALUE!.
This is a small sample and in the cell I just want to be left with the first name.
Peter
Alan
Also, as an alternative, how could I do this on just a single cell with a double click?
VBA Code:
Sub RemoveName()
With Range("J2", Cells(Rows.Count, "J").End(xlUp))
.Value = Evaluate(Replace("IF(ISERROR(FIND("","",@)),@,MID(@,FIND("","",@)+2,LEN(@))", "@", .Address))
End With
End Sub
Contacts Outlook.csv | |||
---|---|---|---|
J | |||
26 | Peter | ||
27 | Shepherd, Alan | ||
Contacts Outlook |
This is a small sample and in the cell I just want to be left with the first name.
Peter
Alan
Also, as an alternative, how could I do this on just a single cell with a double click?