ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clear a sheet. (https://www.excelbanter.com/excel-programming/412857-clear-sheet.html)

Kevin Burton

Clear a sheet.
 
I want to use one sheet as a kind of work area. I plan on filling up cells
with data from various places. To make things easier for this kind of
application I would like to be able to clear a sheet. I want it just as it
started, no tables, no charts, no named ranges, clear all of the data/cells,
etc. I could not find something like sheet.Clear(). If I get a reference to
the work sheet like:

Excel.Worksheet baseSheet = this.Worksheets[1] as Excel.Worksheet;

How would I clear this worksheet?

Thank you.

Kevin

Don Guillett

Clear a sheet.
 
Sub clearsheet()
With ActiveSheet
myname = .Name
Application.DisplayAlerts = False
..Delete
Sheets.Add
ActiveSheet.Name = myname & "new"
End With
End Sub
'probably this one
Sub clearnamedsheet()
With Sheets("template")
Application.DisplayAlerts = False
..Delete
Sheets.Add
ActiveSheet.Name = "Template"
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Kevin Burton" wrote in message
...
I want to use one sheet as a kind of work area. I plan on filling up cells
with data from various places. To make things easier for this kind of
application I would like to be able to clear a sheet. I want it just as it
started, no tables, no charts, no named ranges, clear all of the
data/cells,
etc. I could not find something like sheet.Clear(). If I get a reference
to
the work sheet like:

Excel.Worksheet baseSheet = this.Worksheets[1] as
Excel.Worksheet;

How would I clear this worksheet?

Thank you.

Kevin




All times are GMT +1. The time now is 05:25 PM.

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