Macro for Text to Columns over a set range

virtualmaniac

New Member
Joined
Jun 11, 2015
Messages
2
Hey ladies and gents,

Completely forgot all of my old profile details and no longer have access to my old email so have had to create a new account so I'm not a complete newbie here.

Anyway, I've been creating a system to import dates from an external program. The program exports the dates that are not immediately readable by Excel. I have got the macro to complete the Text to Column function one column at a time (as I know it needs to be completed one column at a time) and I need this to repeat 16 times.

However due to my client's errors occasionally not every column has a date in. When this is the case I need the macro to essentially say, on error, resume to next column, but I cannot get this to work. Any help would be appreciated.

Code:
Sub Data_Fix()
    Selection.TextToColumns Destination:=Range("E5"), DataType:=xlDelimited, _
        TextQualifier:=xlNone, ConsecutiveDelimiter:=False, Tab:=True, Semicolon _
        :=False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, _
        4), TrailingMinusNumbers:=True
    Selection.TextToColumns Destination:=Range("F5"), DataType:=xlDelimited, _
        TextQualifier:=xlNone, ConsecutiveDelimiter:=False, Tab:=True, Semicolon _
        :=False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, _
        4), TrailingMinusNumbers:=True
End Sub

Thank you!
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
63,408
Office Version
  1. 365
Platform
  1. Windows
Maybe try putting:
Code:
On Error Resume Next
at the beginning of your code and then
Code:
On Error Goto 0
at the end of it.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,657
Messages
5,838,632
Members
430,558
Latest member
Krampus

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
Top