If you are on a version of Excel that does not contain "Get External Data" under Data menu (such as Excel 2003, which is my primary version due to the anti-productive "upgrades" of Office 2007 through 2013), you can prevent the "helpful" behavior they force on you either by a few manual steps or by a macro (a macro is faster & easier, so I put it in my personal.xls):
- Add a workbook (or Ctrl+N)
- Type the letter A in cell
A1
- Click cell
A1
- Start “Text to Columns” (or Alt+D, E)
- Choose delimited (or Alt+D)
- Hit Enter
- Unselect every checkbox
- Click Finish (or Alt+F)
- Close the workbook; do not save.
Now the "helpful" behavior will be prevented when you paste again.
In code,
' Differs from Walkenbach in that he just populated A1 if empty, did this on A1, restored A1.
' This is better IFF you are allowed to add a workbook.
Sub FixAutomaticTextToColumns()
If ActiveSheet.ProtectContents Then MsgBox _
"BTW, the active sheet is protected. Consider unprotecting 'ere TextToColumns"
Workbooks.Add
Cells(1) = "A" 'Required, else TextToColumns will error
Cells(1).TextToColumns DataType:=xlDelimited, Tab:=False, semicolon:=False, _
comma:=False, Space:=False, other:=False
ActiveWorkbook.Close False
End Sub
FWIW, I wrote this routine independently, and then discovered
that Excel guru / author / developer John Walkenbach
had published something similar on his site, The Spreadsheet Page,
titled Clearing The Text To Columns Parameters.
See How do I add VBA in MS Office? for general information.
I spent some time to devise, test, and make concise a useful post. And anyone who is not just trolling to downvote would see that this IS a useful, high quality post. What is it with you downvoters? You're just cutting out valuable posts for those who actually WANT answers.
– MicrosoftShouldBeKickedInNuts Jan 21 '18 at 15:18Since I suspect you're dying to know, I wrote a routine on my own. Then I googled other solutions on the net in order to avoid wasting readers' time. I found Walkenbach's solution, but it had tradeoffs; ergo, my comment.
– MicrosoftShouldBeKickedInNuts Jan 21 '18 at 15:23Maybe the downvotes are from precious Seattle fanboys who don't like my name. Well I hope I helped them feel special at how they helped the world today, just like their employer does (Kidding^10). Meanwhile, let's get busy, insecure bullies. You can do better than 5 downvotes in a day. Let's go for a record. Can we get 500 downvotes in one week?
– MicrosoftShouldBeKickedInNuts Jan 21 '18 at 20:03