Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default protect a sheet such that it cannot be deleted

Can I protect a sheet such that users cannot delete or edit or view it?

Thanks in Advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default protect a sheet such that it cannot be deleted

Not really.

Any suggestion that you get would rely on worksheet and workbook protection and
those are pretty easy to break.

So if you don't want others to see the data, don't share that data with them in
excel.

sam wrote:

Can I protect a sheet such that users cannot delete or edit or view it?

Thanks in Advance


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect a sheet such that it cannot be deleted


With a little bit of VBA you can make the sheet xlVeryHidden which means
it cannot be found or unhidden using the toolbar it can only be made
visible via VBA again, however if you protect the worksheet it cannot be
edited (well locked cells cannot) and if you further protect the
workbook structure the sheet cannot be deleted, anyway in a VBA standard
module add and run this (dont forget to change MySheet for your actual
sheet name.

Code:
--------------------

Sub HideMySheet()
Sheets("MySheet").Visible=xlVeryHidden
End Sub

--------------------

*How to add and run a Macro*1. *Copy* the macro above pressing
the keys *CTRL+C*
2. Open your workbook
3. Press the keys *ALT+F11* to open the Visual Basic Editor
4. Press the keys *ALT+I* to activate the *Insert menu*
5. *Press M* to insert a *Standard Module*
6. *Paste* the code by pressing the keys *CTRL+V*
7. Make any custom changes to the macro if needed at this time.
8. *Save the Macro* by pressing the keys *CTRL+S*
9. Press the keys *ALT+Q* to exit the Editor, and return to Excel.

*To Run the Macro...*
To run the macro from Excel, open the workbook, and press *ALT+F8* to
display the *Run Macro Dialog*. Double Click the macro's name to *Run*
it.

sam;418173 Wrote:
Can I protect a sheet such that users cannot delete or edit or view it?

Thanks in Advance



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=116359

  #4   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default protect a sheet such that it cannot be deleted

Thanks for your help, In my situation.. I take user inputs from sheet1
through a userform, and those user inputs are stored in sheet2. So I need
them to access Sheet1 only and not sheet2. Hence I want sheet2 to be
protected such that it cannot be edited, viewed or deleted by these users but
me.


"Simon Lloyd" wrote:


With a little bit of VBA you can make the sheet xlVeryHidden which means
it cannot be found or unhidden using the toolbar it can only be made
visible via VBA again, however if you protect the worksheet it cannot be
edited (well locked cells cannot) and if you further protect the
workbook structure the sheet cannot be deleted, anyway in a VBA standard
module add and run this (dont forget to change MySheet for your actual
sheet name.

Code:
--------------------

Sub HideMySheet()
Sheets("MySheet").Visible=xlVeryHidden
End Sub

--------------------

*How to add and run a Macro*1. *Copy* the macro above pressing
the keys *CTRL+C*
2. Open your workbook
3. Press the keys *ALT+F11* to open the Visual Basic Editor
4. Press the keys *ALT+I* to activate the *Insert menu*
5. *Press M* to insert a *Standard Module*
6. *Paste* the code by pressing the keys *CTRL+V*
7. Make any custom changes to the macro if needed at this time.
8. *Save the Macro* by pressing the keys *CTRL+S*
9. Press the keys *ALT+Q* to exit the Editor, and return to Excel.

*To Run the Macro...*
To run the macro from Excel, open the workbook, and press *ALT+F8* to
display the *Run Macro Dialog*. Double Click the macro's name to *Run*
it.

sam;418173 Wrote:
Can I protect a sheet such that users cannot delete or edit or view it?

Thanks in Advance



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=116359


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protect a sheet such that it cannot be deleted


Then the xlVeryHidden will suit your situation
sam;418303 Wrote:
Thanks for your help, In my situation.. I take user inputs from sheet1
through a userform, and those user inputs are stored in sheet2. So I
need
them to access Sheet1 only and not sheet2. Hence I want sheet2 to be
protected such that it cannot be edited, viewed or deleted by these
users but
me.


"Simon Lloyd" wrote:


With a little bit of VBA you can make the sheet xlVeryHidden which

means
it cannot be found or unhidden using the toolbar it can only be made
visible via VBA again, however if you protect the worksheet it cannot

be
edited (well locked cells cannot) and if you further protect the
workbook structure the sheet cannot be deleted, anyway in a VBA

standard
module add and run this (dont forget to change MySheet for your

actual
sheet name.

Code:
--------------------

Sub HideMySheet()
Sheets("MySheet").Visible=xlVeryHidden
End Sub

--------------------

*How to add and run a Macro*1. *Copy* the macro above pressing
the keys *CTRL+C*
2. Open your workbook
3. Press the keys *ALT+F11* to open the Visual Basic Editor
4. Press the keys *ALT+I* to activate the *Insert menu*
5. *Press M* to insert a *Standard Module*
6. *Paste* the code by pressing the keys *CTRL+V*
7. Make any custom changes to the macro if needed at this time.
8. *Save the Macro* by pressing the keys *CTRL+S*
9. Press the keys *ALT+Q* to exit the Editor, and return to Excel.

*To Run the Macro...*
To run the macro from Excel, open the workbook, and press *ALT+F8* to
display the *Run Macro Dialog*. Double Click the macro's name to

*Run*
it.

sam;418173 Wrote:
Can I protect a sheet such that users cannot delete or edit or view

it?

Thanks in Advance



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage - Microsoft Office Help - Microsoft

Office Discussion' (http://www.thecodecage.com))

------------------------------------------------------------------------
Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon

Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread: 'protect a sheet such that it cannot be deleted -

The Code Cage Forums'
(http://www.thecodecage.com/forumz/sh...d.php?t=116359)




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=116359



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default protect a sheet such that it cannot be deleted

You can make the sheet visible via the properties window (in the VBE) for that
sheet. You'd want to protect the workbook project, too.

But this workbook protection is easily broken and code to unhide the sheet could
exist in a different workbook's project.

Simon Lloyd wrote:

With a little bit of VBA you can make the sheet xlVeryHidden which means
it cannot be found or unhidden using the toolbar it can only be made
visible via VBA again, however if you protect the worksheet it cannot be
edited (well locked cells cannot) and if you further protect the
workbook structure the sheet cannot be deleted, anyway in a VBA standard
module add and run this (dont forget to change MySheet for your actual
sheet name.

Code:
--------------------

Sub HideMySheet()
Sheets("MySheet").Visible=xlVeryHidden
End Sub

--------------------

*How to add and run a Macro*1. *Copy* the macro above pressing
the keys *CTRL+C*
2. Open your workbook
3. Press the keys *ALT+F11* to open the Visual Basic Editor
4. Press the keys *ALT+I* to activate the *Insert menu*
5. *Press M* to insert a *Standard Module*
6. *Paste* the code by pressing the keys *CTRL+V*
7. Make any custom changes to the macro if needed at this time.
8. *Save the Macro* by pressing the keys *CTRL+S*
9. Press the keys *ALT+Q* to exit the Editor, and return to Excel.

*To Run the Macro...*
To run the macro from Excel, open the workbook, and press *ALT+F8* to
display the *Run Macro Dialog*. Double Click the macro's name to *Run*
it.

sam;418173 Wrote:
Can I protect a sheet such that users cannot delete or edit or view it?

Thanks in Advance


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=116359


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I protect a sheet so the rows/columns can't be deleted? Dani Excel Worksheet Functions 1 April 8th 09 07:22 PM
How do I protect a whole folder from getting deleted??? Wendy Excel Discussion (Misc queries) 1 November 13th 07 12:10 AM
Protect one tab from being deleted np Excel Discussion (Misc queries) 0 October 31st 07 05:39 PM
How do I protect formulas from being deleted? Connie Excel Worksheet Functions 2 May 10th 06 01:04 AM
protect a workbook from being deleted Toni's Taxi Excel Discussion (Misc queries) 1 January 12th 05 07:38 PM


All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"