Text to Columns Macro

TooZippy

Board Regular
Joined
Dec 30, 2018
Messages
70
I tried recording a macro and at first it worked then I got trouble with it. I found this macro on the internet and it worked at first, but when I tried to run it today I got the debug box to pop up. Can anybody tell me what is wrong with it and offer any suggestions so that it would work please? The characters in the cells that I want to put in their own column are separated by spaces.

Thank you,

Jared Z.

Code:
[LEFT][COLOR=#1D2228][FONT=Helvetica Neue]Sub Text_to_Columns()[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]    Dim objRange1 As Range[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]    [/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]    'Set up the range[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]    Set objRange1 = Range("D:D")[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]    [/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]    objRange1.TextToColumns _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      Destination:=Range("Q2"), _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      DataType:=xlDelimited, _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      Tab:=False, _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      Semicolon:=False, _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      Comma:=False, _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      Space:=True, _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      Other:=True, _[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]      OtherChar:="  "[/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue] [/FONT][/COLOR]
[COLOR=#1D2228][FONT=Helvetica Neue]End Sub[/FONT][/COLOR][/LEFT]
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I checked the debug box again. It says "Run-time error '1004': No data was selected to parse." ??? Set objRange1 = Range("D:D") ???

Thank you,

Jared Z.
 
Upvote 0
In that case there is no data in col D of the active sheet.
 
Upvote 0
Where abouts in col D is the data?
Also what type of data is it, formulas, table,what?
 
Upvote 0
There is a header at the top of column D followed by two blank cells then data in row four. There are blank cells hear and there down the column and it is only text data.

Thank you,

Jared Z.
 
Upvote 0
You don't happen to have any merged cells or protected ranges on your worksheet, do you?
 
Upvote 0
Since no one can seem to recreate your issue, your best bet may be to upload a copy of your data file to a file sharing site, and provide a link to it here.
Someone will probably download it and take a look to see what the issue may be,
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top