I have a column on my sheet, Column F which is full of dates. Now I need these dates to be in this format "dd,mm,yyyy" but sometimes they are in text form, us/armenian format in the original data. Why I apply a macro to convert it in the correct format, it switches the dates and months around sometimes but if I do it manually no such error occurs.
Am using paste values to get the data in my worksheet and this is my code. It shows the correct month for the format dd/mmm/yyyy but the switches the months and date.
Range("F2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.NumberFormat = "dd/mmm/yyyy"
Selection.TextToColumns Destination:=Range("F2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 4), TrailingMinusNumbers:=True
Selection.NumberFormat = "dd/mm/yyyy"
Lets take cell F2, date is 9th Jan 2009 in the format 09/01/2009.
When I do my text to columns, it leaves the date as 09/01/2009.
When I repeat the text to columns (making no changes whatsoever) it changes the date (not the format) to 1st September 2009.
Does anyone know why this is happening? If I do text to columns manually, I can repeat it all day long with it staying in the format I like.
The problem only occurs if I repeat the macro, am not sure what I am doing wrong. Have tried changing fieldinfo to array(array(1,4) to no avail.
Hope someone can help.