ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   save automatically 1st sheet only (https://www.excelbanter.com/excel-programming/346503-save-automatically-1st-sheet-only.html)

shital shah

save automatically 1st sheet only
 
Hi to all
How do i save automatically 1st sheet only from file and give name to that
file is the name of the sheet.

any help.

Thanks

Shah

chijanzen

save automatically 1st sheet only
 
Hi

try it

Sub CopySheet()
Dim wks As Worksheet
Set wks = Worksheets("sheet1")
wks.Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "c:\" & wks.Name
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"****al shah" wrote:

Hi to all
How do i save automatically 1st sheet only from file and give name to that
file is the name of the sheet.

any help.

Thanks

Shah


chijanzen

save automatically 1st sheet only
 
****al shah:

Another method:

ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path _
& "\" & ActiveSheet.Name, FileFormat:=xlExcel4


--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"****al shah" wrote:

Hi to all
How do i save automatically 1st sheet only from file and give name to that
file is the name of the sheet.

any help.

Thanks

Shah



All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com