Hi all, i need some help to re-format dates in a spreadsheet from US to UK. The attached Dates.xls contains the US style date format
So far i have the code below to open the spreadsheet, autofit the columns, and set the font size to 8pt. Just need some help with the date re-formatting. Can someone help me with the missing bit? Thanks
Private Sub Excel_Click()
' Open up the spreadsheet
Set xlapp = CreateObject("Excel.Application")
xlapp.Application.Visible = False
xlapp.Workbooks.Open ("C:\DATES.XLS")
Set xlwkb = xlapp.Application.ActiveWorkbook
' Set overall font to Arial, 8pt
xlapp.Cells.Select
xlapp.Selection.Font.Name = "Arial"
xlapp.Selection.Font.Size = "8"
' Now autofit columns
xlapp.Cells.Select
xlapp.Selection.columns.AutoFit
xlapp.Application.Rows("1:1").Select
'**********************************************
' Function to format US date code to UK date code i.e dd/mm/yy in all 3 columns
'Any ideas?
'**********************************************
' Save and close the spreadsheets
xlapp.ActiveWorkbook.Save
xlapp.ActiveWorkbook.Close
End Sub
So far i have the code below to open the spreadsheet, autofit the columns, and set the font size to 8pt. Just need some help with the date re-formatting. Can someone help me with the missing bit? Thanks
Private Sub Excel_Click()
' Open up the spreadsheet
Set xlapp = CreateObject("Excel.Application")
xlapp.Application.Visible = False
xlapp.Workbooks.Open ("C:\DATES.XLS")
Set xlwkb = xlapp.Application.ActiveWorkbook
' Set overall font to Arial, 8pt
xlapp.Cells.Select
xlapp.Selection.Font.Name = "Arial"
xlapp.Selection.Font.Size = "8"
' Now autofit columns
xlapp.Cells.Select
xlapp.Selection.columns.AutoFit
xlapp.Application.Rows("1:1").Select
'**********************************************
' Function to format US date code to UK date code i.e dd/mm/yy in all 3 columns
'Any ideas?
'**********************************************
' Save and close the spreadsheets
xlapp.ActiveWorkbook.Save
xlapp.ActiveWorkbook.Close
End Sub