ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting sheets (https://www.excelbanter.com/excel-programming/338780-deleting-sheets.html)

TK[_3_]

Deleting sheets
 
Has anybody done this?
Is there a way I can save the current cell values in sheet 1, delete my data
sheet (sheet 2) with a macro?

Thanks



Rowan[_4_]

Deleting sheets
 
Maybe something like this, save your file before running this;

Sub DelSht()
On Error GoTo ErrorHandler
Application.DisplayAlerts = False
With Sheets("Sheet1")
.Cells.Copy
.Cells.PasteSpecial Paste:=xlValues
End With
Sheets("Sheet2").Delete
ErrorHandler:
Application.DisplayAlerts = True
End Sub

Hope this helps
Rowan

"TK" wrote:

Has anybody done this?
Is there a way I can save the current cell values in sheet 1, delete my data
sheet (sheet 2) with a macro?

Thanks




William Benson[_2_]

Deleting sheets
 
Hi,

Worksheets("Sheet2").Cells.Copy
Worksheets("Sheet1").Cells.PasteSpecial Paste:=xlPasteValues
Application.DisplayAlerts = False
Worksheets("Sheet2").Delete
Application.DisplayAlerts = True


"TK" wrote in message
. ..
Has anybody done this?
Is there a way I can save the current cell values in sheet 1, delete my
data
sheet (sheet 2) with a macro?

Thanks






All times are GMT +1. The time now is 02:13 AM.

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