Importing colon-separated fields

midsession

Board Regular
Joined
Oct 12, 2006
Messages
70
Hello MrExcel

I am importing tables via WebQuery where some columns contain data separated by a colon. I can split the data using TextToColumns, but I can't get the worksheet to display the data 'as is' -it insists on treating it as a time. For instance ...
If I import 0:3 worksheet displays 12 and 3
If I import 13:3 worksheet displays 1 and 3

Worse than that, when I record a macro, the split and copy seems to work fine. When I rerun the macro it reverts to reading 17:06 as 5 and 06!

Can anyone help?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

midsession

Board Regular
Joined
Oct 12, 2006
Messages
70
Makes no difference whether NumberFormat is General or @ before TextToColumns

On TextToColumns, FieldInfo is currently Array(Array(1, 2), Array(2, 2), Array(3, 9)). This setup is due to the fact that Excel reads the cell format as custom hh:mm, with the consequence that when you run TextToColumns manually it thinks it has three fields to split (17:06:00).
Again, no diff if setup is Array(Array(1, 1), Array(2, 1), Array(3, 9)).
 

midsession

Board Regular
Joined
Oct 12, 2006
Messages
70
Are people not able to replicate this problem? Maybe it's a date-reading system setting rather than the code ...
 

Forum statistics

Threads
1,172,140
Messages
5,879,273
Members
433,416
Latest member
montex01

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