PDA

View Full Version : VBA for automatic Text to Columns


DrJ
Nov 16, 2011, 01:12 PM
Is there a way to write a VBA script that can accomplish the same as using Text to Columns? Right now, my users have to paste data into a spreadsheet, which then takes that data and fills in the necessary fields throughout the whole spreadsheet giving them instant access to all the calculations needed.

All they have to do is paste into one cell... I was hoping Excel would save the spreadsheet ON the Data tab with the Text to Columns set up as Delimited with the delimiter set to a colon (:). However, it does not. Rather than having the user have to paste, select the Data tab, select Text to Columns, hit Next, uncheck Tab, check Other, put a : in the box, hit Next, and hit Finish (which may be easy enough for some but leaves too much room for error with a sales team), I was hoping there might be a more automated way of doing this.

Any ideas?

DrJ
Nov 16, 2011, 02:25 PM
Holy cow! I just discovered the Record Macro button! I never knew Excel could do that! Makes it SOOOOO much easier than trying to code VB!

For anyone else that may be looking into this, you have to enable the Developer tab (via Excel Options), select the developer tab, select Record Macro, do the command manually, then return to the Developer tab to stop recording... and it writes the macro for you!

Curlyben
Nov 16, 2011, 02:43 PM
Dude, Marcos, been around since the dawn of time ;)
(well least since Office 2000, maybe 95)

Where you been.

ScottGem
Nov 16, 2011, 04:18 PM
Macros and the ability to record them go back to VisiCalc. Welcome to the wonderful world of spreadsheets.