LionelNZ Posted October 2, 2007 Share Posted October 2, 2007 Good morning all from NZ.I download our bank accounts as a CSV file & then I have a macro that imports the CSV sheet into a XLS workbook & this works fine except that lately the date Col is causing problems.I format the date to dd/mm as part of the macro but The problem is that for some reason, after about 30 rows, the date changes from number/date format to text.So instead of 17/09 i will have 17/09/2007 AFTER about 30 rows.Below is the macro that I use to enter date & format cols.With basebookRange("H1").FormulaR1C1 = "SheetName"Range("b2:B" & Cells(Rows.Count, "B").End(xlUp).Row).NumberFormat = "#,##0.00"Range("H2:H" & Cells(Rows.Count, "A").End(xlUp).Row).Value = ActiveSheet.NameRange("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).NumberFormat = "DD/MM"Range("A1:I1").SelectSelection.Font.Bold = TrueSelection.AutoFilterEnd WithI know it changes to text because the date is all left aligned and if I go into the cell place the cursor at the begining of the date & backspace the format changes to DD/MM & right aligns.What I need to know is can I build in to the macro code that ensure the date will be read as Date in the format DD/MM and if there is a way what is the code?TIALionel DownUnda Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now