I've got a relatively simple task of exporting selected columns into a CSV ready to be used in another program.
The macro seems to work as advertised with the exception that the dates do not keep their UK format but are resolved into USA format.
The locales are set correctly on both my PC and the PC where the original xls file originates.
Anyone know what tweak I need to make to the macro to make it export the date in UK format?
I've attached a simplified version of the excel spreadsheet along with the VBA coding.
Sub ExportToCSV() Dim wsOld As Worksheet Dim wsNew As Worksheet Dim vFile Set wsOld = ActiveSheet Set wsNew = Workbooks.Add(xlWorksheet).Sheets(1) wsOld.Range("C:D").Copy wsNew.Range("A:B") wsOld.Range("F:G").Copy wsNew.Range("C:D") wsOld.Range("H:H").Copy wsNew.Range("E:E") wsOld.Range("K:K").Copy wsNew.Range("F:F") wsOld.Range("O:P").Copy wsNew.Range("G:H") vFile = Application.GetSaveAsFilename(FileFilter:="CSV files (*.csv),*.csv") If TypeName(vFile) = "Boolean" Then Exit Sub 'cancelled Application.DisplayAlerts = False wsNew.SaveAs vFile, FileFormat:=xlCSV Application.DisplayAlerts = True wsNew.Parent.Close False End Sub