Cherub Wings
New Member
- Joined
- Apr 16, 2021
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hello,
I'm attempting to use Text-to-Column with Delimiters Comma, Space, or Colon for Column C. The code does not work using the macro recorder, and after hours of research, the best option I could find was using the code below, but the code only splits cell C2 by spaces, then just stops.
Sample Code:
Dim ttlrowcount As Integer
Dim ttlcount As Integer
ttlrowcount = WorksheetFunction.CountA(Range("C:C"))
Range("C2").Select
For ttlcount = 1 To ttlrowcount
ActiveCell.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, Space:=True
Next
'This is only splitting the first cell C2, but only split the commas...then just stops
Worksheet Example:
'Col A' 'Col B' 'Col C'
Bldg - Room - Name
Bldg 1 - Upstairs - John Michael Smith, Number:653152, Date:6/13/2023
Bldg 4 - Downstairs - Jane Lucy Smith, Number:278659, Date:3/20/2022
Bldg 2 - Upstairs - Michael Dean Johnson, Number:331513, Date:8/22/2021
Bldg 1 - Upstairs - Robert Christopher Jones, Number:289630, Date:1/13/2022
Bldg 3 - Downstairs - William Richard Lee, Number:301992, Date:3/17/2023
Any recommendations on splitting and isolating everything that's in Column C?
Much appreciated,
Cherub Wings
I'm attempting to use Text-to-Column with Delimiters Comma, Space, or Colon for Column C. The code does not work using the macro recorder, and after hours of research, the best option I could find was using the code below, but the code only splits cell C2 by spaces, then just stops.
Sample Code:
Dim ttlrowcount As Integer
Dim ttlcount As Integer
ttlrowcount = WorksheetFunction.CountA(Range("C:C"))
Range("C2").Select
For ttlcount = 1 To ttlrowcount
ActiveCell.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, Space:=True
Next
'This is only splitting the first cell C2, but only split the commas...then just stops
Worksheet Example:
'Col A' 'Col B' 'Col C'
Bldg - Room - Name
Bldg 1 - Upstairs - John Michael Smith, Number:653152, Date:6/13/2023
Bldg 4 - Downstairs - Jane Lucy Smith, Number:278659, Date:3/20/2022
Bldg 2 - Upstairs - Michael Dean Johnson, Number:331513, Date:8/22/2021
Bldg 1 - Upstairs - Robert Christopher Jones, Number:289630, Date:1/13/2022
Bldg 3 - Downstairs - William Richard Lee, Number:301992, Date:3/17/2023
Any recommendations on splitting and isolating everything that's in Column C?
Much appreciated,
Cherub Wings