Recorded a simple macro to copy & paste from 1 sheet to a new sheet, then I added code I found here to save as a CSV file using the name from a cell.
It fails on
FileFormat:=xlCSV
I am a complete beginner with VB, so any help appreciated.
Thanks
Gaz
It fails on
FileFormat:=xlCSV
VBA Code:
Sub XeroCSV()
'
' XeroCSV Macro
'
'
Dim FileName As String
Dim Path As String
Sheets("Xero Import").Select
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
Application.DisplayAlerts = False
Path = "H:\Documents\Xero Reports\IRIS Payroll Data for Xero\"
FileName = Range("G2").Value & ".csv"
ActiveWorkbook.SaveAs Path & FileName
FileFormat:=xlCSV
Application.DisplayAlerts = True
ActiveWindow.Close
Sheets("Journal").Select
Range("G5").Select
End Sub
I am a complete beginner with VB, so any help appreciated.
Thanks
Gaz