"Convert Text to Table" works okay when converting manually, but when recorded as a macro, it messes up my dates

fda92

New Member
Joined
Feb 19, 2022
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
Hi!

I'm helping out an eBay seller who's using a .csv to calculate his late shipments.

A bit of context: eBay normally gives a report for that with the dates each late shipping took place. However, this report made by eBay has inconsistent formatting rules in the way dates are handled -- some not being even formatted as dates, but as a bunch of text that Excel cannot even interpret as such by changing the formatting.

To create a reusable model (which would work just by copy-pasting the data from the .csv to this file and calculate stuff automatically) I needed to be creative in Excel and create a series of SUBSTITUTE, VLOOKUP, etc. to convert dates like "09 November 2021 CET" to "09/11/2021" (I'm EU-based, so we follow dd/mm/yyyy). To make sure the spaghetti code I created in Excel works, it's important that the column J (which is using a "custom date" format) is formatted as text in the Excel.

This works perfectly okay when I use copy-paste the values from the .csv and use the Convert Text to Table function.

"That's fine", I thought, "I'll just record it as a Macro, so that the seller can do it by themselves".

However, the moment the Macro is recorded (converting again, as text) and I use the key, Excel switches up all months and days. I'm not too sure

Note that I'm based in Europe, so I'm not too sure if changing the region settings of my PC may help.

The Macro is:

Sub Macro3()
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+Shift+J
'
Columns("J:J").Select
Selection.TextToColumns Destination:=Range("J1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(1, 2), TrailingMinusNumbers:=True
End Sub
 

Attachments

  • Cattura.PNG
    Cattura.PNG
    4.6 KB · Views: 11
  • Cattura2.PNG
    Cattura2.PNG
    8.1 KB · Views: 10
  • Cattura3.PNG
    Cattura3.PNG
    9.5 KB · Views: 11

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Leaving a link to the copy of the file. Hopefully it can help to better send the point across.

 
Upvote 0

Forum statistics

Threads
1,214,528
Messages
6,120,064
Members
448,941
Latest member
AlphaRino

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