Exit or Close button

MarkDShark

Board Regular
Joined
Jun 10, 2008
Messages
228
How do you add a exit or close button to a worksheet? I hide all the commands and edit bars and locked the VBA codes, so the sheet coud not be accesed or changed. I did the simular thing on other worsheets, but when i have multiple open, i cannot exit one out without having to close them all. The solution is to create an exit button or close button to close the sheet im on. Thanks!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi
you can't close just the active sheet but you can close the active window:

ActiveWindow.Close SaveChanges:=False

or you can hide the activesheet, but then you need to use code to unhide the sheets also,

Code:
Private Sub CommandButton1_Click()
 ActiveSheet.Visible = xlVeryHidden
End Sub

To unhide

Sheet1.Visible = xlSheetVisible
<!-- / message --><!-- sig -->
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,843
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top