ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Close worksheet by means of a macro (https://www.excelbanter.com/excel-worksheet-functions/127272-close-worksheet-means-macro.html)

Lloyd

Close worksheet by means of a macro
 
Hi

I need to close a worksheet with a button, so I need a macro to attach.

Thanksing you

Mike

Close worksheet by means of a macro
 
You can't close a worksheet, you can hide it or switch to another sheet or
even close the workbook. Which do you want to do?

You can switch to

"Lloyd" wrote:

Hi

I need to close a worksheet with a button, so I need a macro to attach.

Thanksing you


Lloyd

Close worksheet by means of a macro
 
Sorry I met WorkBook

"Mike" wrote:

You can't close a worksheet, you can hide it or switch to another sheet or
even close the workbook. Which do you want to do?

You can switch to

"Lloyd" wrote:

Hi

I need to close a worksheet with a button, so I need a macro to attach.

Thanksing you


Mike

Close worksheet by means of a macro
 
try this

Sub Button1_Click()
ActiveWorkbook.Close savechanges = True
End Sub

savechanges could also be False

"Lloyd" wrote:

Sorry I met WorkBook

"Mike" wrote:

You can't close a worksheet, you can hide it or switch to another sheet or
even close the workbook. Which do you want to do?

You can switch to

"Lloyd" wrote:

Hi

I need to close a worksheet with a button, so I need a macro to attach.

Thanksing you



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

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