Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi all,
I want to delete all dat in the sheet1 when I close the workbook, but not understand to write VBA code for excel.Is it possible ? How to write it? Many thank's. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi,
Are you absolutely sure you want to delete everyting? Warning this will delete everything in Sheet1 and I mean everything so use it with caution and try it on a backup wotkbook first. Alt + F11 to open VB editor. Double click 'This workbook' and paste the code in. Private Sub Workbook_BeforeClose(Cancel As Boolean) Sheets("Sheet1").UsedRange.ClearContents End Sub Mike "shiro" wrote: Hi all, I want to delete all dat in the sheet1 when I close the workbook, but not understand to write VBA code for excel.Is it possible ? How to write it? Many thank's. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Right-click on the Excel logo left of "File" on the main menu.
Select "View Code" Paste this into that module. Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Sheet1").Cells.ClearContents .Save End With End Sub Gord Dibben MS Excel MVP On Mon, 21 Jan 2008 18:34:51 +0700, "shiro" wrote: Hi all, I want to delete all dat in the sheet1 when I close the workbook, but not understand to write VBA code for excel.Is it possible ? How to write it? Many thank's. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
"logo" should have been "icon"
Gord On Mon, 21 Jan 2008 10:48:31 -0800, Gord Dibben <gorddibbATshawDOTca wrote: Right-click on the Excel logo left of "File" on the main menu. Select "View Code" Paste this into that module. Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Sheet1").Cells.ClearContents .Save End With End Sub Gord Dibben MS Excel MVP On Mon, 21 Jan 2008 18:34:51 +0700, "shiro" wrote: Hi all, I want to delete all dat in the sheet1 when I close the workbook, but not understand to write VBA code for excel.Is it possible ? How to write it? Many thank's. |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Many thank's Sirs.
Workgreat. "Gord Dibben" <gorddibbATshawDOTca wrote in message ... "logo" should have been "icon" Gord On Mon, 21 Jan 2008 10:48:31 -0800, Gord Dibben <gorddibbATshawDOTca wrote: Right-click on the Excel logo left of "File" on the main menu. Select "View Code" Paste this into that module. Private Sub Workbook_BeforeClose(Cancel As Boolean) With ThisWorkbook .Worksheets("Sheet1").Cells.ClearContents .Save End With End Sub Gord Dibben MS Excel MVP On Mon, 21 Jan 2008 18:34:51 +0700, "shiro" wrote: Hi all, I want to delete all dat in the sheet1 when I close the workbook, but not understand to write VBA code for excel.Is it possible ? How to write it? Many thank's. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I delete data in worksheet, but not the associated formula | Excel Worksheet Functions | |||
delete a worksheet | Excel Discussion (Misc queries) | |||
How to delete a duplicate Excel worksheet within that worksheet? | Excel Discussion (Misc queries) | |||
How do you delete a worksheet? | Excel Discussion (Misc queries) | |||
how do I delete data from a worksheet without deleting the formul. | Excel Discussion (Misc queries) |