Packard40,
Thanks for the workbook.
I assume that the actual raw data worksheet is Sheet1. And, that the tiles are in row 1.
Macro execution time on your current dataset was 0.000 seconds.
Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
1. Copy the below code
2. Open your NEW workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
Option Explicit
Sub CopyLeadingText()
' stanleydgromjr, 09/29/2013
' http://www.excelforum.com/excel-general/957982-problem-selecting-only-alpha-characters-from-cell-1-and-merge-another-cell.html
Dim a As Variant, s
Dim i As Long, c As Long, h As String
With Sheets("Sheet1")
a = .Cells(1).CurrentRegion
For i = 2 To UBound(a, 1)
For c = 2 To UBound(a, 2)
If InStr(a(i, c), " - ") > 0 Then
s = Split(a(i, c), " - ")
h = s(0) & " - "
ElseIf InStr(a(i, c), " -") > 0 Then
s = Split(a(i, c), " -")
h = s(0) & " -"
ElseIf a(i, c) = "" Then
'do nothing
ElseIf a(i, c) <> "" And IsNumeric(a(i, c)) Then
a(i, c) = h & a(i, c)
End If
Next c
Next i
.Cells(1).CurrentRegion = a
.Columns.AutoFit
End With
End Sub
Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm
Then run the CopyLeadingText macro.
Bookmarks