View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KenY KenY is offline
external usenet poster
 
Posts: 19
Default Texttocolumns and Date Format using Macro - UK International setti

Would appreciate any help on this one. Using Excel 2003 / Windows XP SP2.

I import information from a database - this includes dates that are in
MM/DD/YYYY format. As I am in the UK, Excel's auto-features convert some of
the dates correctly, others incorrectly. I therefore use the
data/texttocolumns function to give correct dates - have done this many times.

I have just tried to record a macro using these steps (remembering to select
the MDY option for the date format). The result was perfect when recording.
However, when running the macro on fresh data, it failed - an example is a
data that when imported was
5/1/2007 (1 May 2007, US format)

and when manually changed using text to columns shows as
1/5/2007 (1 May 2007, UK format).

converting using the recorded macro gives the result
5/1/2007 (5 Jan 2007, UK format)

I suspect this may be caused in some way by the International Date settings
being ignored by the macro, but used in manual activity. However I have no
idea how to change the behaviour within a macro.

I could re-write the whole macro so that I parse each cell and assign the
values to the correct date component, but that would be much of a
sledge-hammer to crack a nut.

Thanks for reading this - hope you can help me.

--
KenY