Text to Columns Time Issue in Macro

mpersico

New Member
Joined
Dec 14, 2015
Messages
2
I have data that is formatted like so...

calldate
12/12/2015 18:52
12/12/2015 16:50
12/12/2015 16:17
12/12/2015 14:00
12/12/2015 13:44
12/12/2015 13:35
12/12/2015 13:11

<tbody>
</tbody>


I'm running a macro, and one part of that macro is to separate the date/time column into date and time using text to columns. When I manually perform text to columns, my data comes out like so...

DateTime
12/12/201518:52:00
12/12/201516:50:00
12/12/201516:17:00
12/12/201514:00:00
12/12/201513:44:00
12/12/201513:35:00
12/12/201513:11:00

<tbody>
</tbody>


When I run the same thing in a macro, my data comes out like this...

DateTime
12/12/201506:52:00
12/12/201504:50:00
12/12/201504:17:00
12/12/201502:00:00
12/12/201501:44:00
12/12/201501:35:00
12/12/201501:11:00

<tbody>
</tbody>


I'm in Excel 2010. When I am doing text to columns, I'm using the delimited option, and setting the delimiter to space. I've set my Windows date format to short date HH:mm, and long date HH:mm:ss, however I don't want to use that option because this is for cleaning data in a work setting and I don't want others to have to adjust their settings on Windows in order to use the macro. Also, that option isn't working for the macro anyways. I'm cleaning approximately 35,000 lines of data or more in each batch, so it can't be done by hand in a reasonable sense. I don't currently have Visual Studio installed on this machine, however I will be getting it soon so I can work with that more. I don't have a lot of experience with writing VB code for Excel spreadsheets, but I have a passing familiarity with VB.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
It may just be the format of your Time column (note that the times look the same, except they are PM, i.e. 18:52 is equal to 6:52 PM).
What time format on you using on the converted Time column?

It might also be helpful if you paste your macro code.
 
Upvote 0
I'm working on getting Visual Studio put on my computer so I can paste up the macro code. The problem is that when it's translated over to 01:11:00, it's then assigning "AM" to all of those columns.
 
Upvote 0
Is this data in an Excel sheet?
If so, why are you using VB in Visual Studio for Text to Columns instead of just using Excel's Text to Columns (with or without Excel's VBA instead of VB)?
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

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