I have several sheet and have written code to export these to directory C:\data
I would like to mend the code to only export that sheets that has data in cell A1
Your assistance in this regard is most appreciated
I would like to mend the code to only export that sheets that has data in cell A1
Your assistance in this regard is most appreciated
Code:
Sub ExportSheetsToCSV()
Application.DisplayAlerts = False
Dim xWs As Worksheet
Dim xcsvFile As String
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.Copy
xcsvFile = "C:\data" & "\" & xWs.Name & ".csv"
Application.ActiveWorkbook.SaveAs Filename:=xcsvFile, _
FileFormat:=xlCSV, CreateBackup:=False
Application.ActiveWorkbook.Saved = True
Application.ActiveWorkbook.Close
Next
Close_Book
Application.DisplayAlerts = True
End Sub