Copying date into Excel

afc171

Board Regular
Joined
Jan 14, 2017
Messages
145
Office Version
  1. 2013
Platform
  1. Windows
Hi all,

I have to copy data from SAP which puts the date as 01.07.24 but Excel doesn't pick this up properly, even when changing the format. So I ran a macro to convert text to column, but when you run the macro each time it will mess up...

So this is correct, but when you run macro again it swaps the day and month around...

ProductPath.xlsm
ABCDEF
1PRODUCTQTYBATCHSTART DATESTARTDOCUMENT
2103008116753005/02/202414:18:2211093552
31990-0804216554405/02/202414:15:3511093552
4204002216663705/02/202414:17:5911093551
54020021116754205/02/202414:16:2611093388
PRODUCTS


Vs..

ProductPath.xlsm
ABCDEF
1PRODUCTQTYBATCHSTART DATESTARTDOCUMENT
2103008116753002/05/202414:18:2211093552
31990-0804216554402/05/202414:15:3511093552
4204002216663702/05/202414:17:5911093551
54020021116754202/05/202414:16:2611093388
68437-5208215247002/05/202413:59:5511093553
PRODUCTS



VBA Code:
    Range("D2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.TextToColumns Destination:=Range("D2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 4), TrailingMinusNumbers:=True
    Range("Table3[[#Headers],[PRODUCT]]").Select

I just need this to run once or is there another way to sort it?

Thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Change the Array(1, 2) it seems to be working now!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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