I have some sheets open in my Excel workbook and I need to save only one of them ( sinani-05
) with a specific name in CSV format. Can you please let me know how to do this?
I already found this on StackOverflow:
WS.SaveAs "E:\\Data\CSV\" & WS.Name & ".csv", xlCSV
but I'm not sure how to update it to save only the mentioned sheet ( sinani-05
).
You can use the Copy()
function to copy a worksheet to a new workbook, then save the new workbook. For example:
' This copies the sheet named "sinani-05" to a new workbook...
Sheets("sinani-05").Copy
' and this saves the new workbook as a CSV...
ActiveWorkbook.SaveAs "E:\Data\CSV\sinani-05.csv", xlCSV
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.