I am exporting about 30 worksheets in my file to a location to store them as csv's. I am looking to add in 2 things to the code:
- applying a color to a few of the rows in the destined csv
- only exporting visible cells into the csv
Sub CopyToCSV()
Dim MyPath As String
Dim MyFileName As String
MyPath = "S:\File\Folder\Test"
MyFileName = "Sheet" & Format(Date, "ddmmyy")
If Not Right(MyPath, 1) = "\" Then MyPath = MyPath & "\"
If Not Right(MyFileName, 4) = ".csv" Then MyFileName = MyFileName & ".csv"
Sheets("Sheet").Copy
With ActiveWorkbook
.SaveAs Filename:= _
MyPath & MyFileName, _
FileFormat:=xlCSV, _
CreateBackup:=False
.Close False
End With
End Sub
Appreciate the help
Bookmarks