![]() |
rename worksheets after copy
I want to rename "Emp1" to "NewData". Here is my code.
Private Sub Send1_Click() Dim strDate As String Sheets(Array("Emp1", "Main")).Copy strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") ActiveWorkbook.SaveAs "NewEmployeeData.xls" ActiveWorkbook.SendMail "", _ "Employee Attendance Data" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False End Sub |
rename worksheets after copy
Private Sub Send1_Click()
Dim strDate As String, sName as STring Sheets(Array("Emp1", "Main")).Copy strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") Worksheets("Emp1").Name = "NewData" ActiveWorkbook.SaveAs "NewEmployeeData.xls" ActiveWorkbook.SendMail "", _ "Employee Attendance Data" sname = ActiveWorkbook.Fullname ActiveWorkbook.Close False Kill sName End Sub -- Regards, Tom Ogilvy "Qaspec" wrote in message ... I want to rename "Emp1" to "NewData". Here is my code. Private Sub Send1_Click() Dim strDate As String Sheets(Array("Emp1", "Main")).Copy strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") ActiveWorkbook.SaveAs "NewEmployeeData.xls" ActiveWorkbook.SendMail "", _ "Employee Attendance Data" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False End Sub |
rename worksheets after copy
Hi Qaspec
Use this Sheets(Array("Emp1", "Main")).Copy Sheets("Emp1").Name = "NewData" -- Regards Ron de Bruin http://www.rondebruin.nl "Qaspec" wrote in message ... I want to rename "Emp1" to "NewData". Here is my code. Private Sub Send1_Click() Dim strDate As String Sheets(Array("Emp1", "Main")).Copy strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") ActiveWorkbook.SaveAs "NewEmployeeData.xls" ActiveWorkbook.SendMail "", _ "Employee Attendance Data" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False End Sub |
All times are GMT +1. The time now is 09:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com