I took the macro code from using the “text to columns” wizard and put it in my code. But it’s not working on a consistent basis.
I am getting “method ‘range’ of object ‘_global’ failed” (sometimes)
I looked it up, and applied solutions, that either change nothing (it errors a few executions later)
The current attempt to specify it better has left me with
With Shipping
.ActiveSheet.Columns(letter & ":" & letter).TextToColumns Destination:=Range(letter & "1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 9), Array(3, 9), Array(4, 9)), TrailingMinusNumbers:= _
True
End With
I have no idea if it wants me to specify better for the first half or the destination, which I can’t find a solution for.
How do I make this work?
Rather than using (eg)
.ActiveSheet.Columns("A:A")why not use the simpler form.ActiveSheet.Columns(1)?And add a period before
Rangein the Destination parameter, otherwise that range will default to the active sheet.