Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,344
Default I can't able to protect a sheet if it having any column / rows

Hi,

First, thanks Gord for interpreting the question.

The code Gord gave you must be added to the thisWorkbook_Open object and it
will automatically run.

Here is how you add the code he gave to your workbook:
0. Copy the code from the post and modify it by changing the password part
to whatever password you are using.
1. With the workbook open press Alt+F11
2. In the top left part of the screen the Project window is displayed with
your workbook and possilby others. You will see a line that reads VBAProject
(your file name.xls) under that is a folder called Microsoft Excel Objects,
open it if necessary so you can see something called ThisWorkbook.
3. Double click ThisWorkbook and on the screen on the right (empty white
area) paste in the code.
4. Click the Save button.
5. Close the VBA window, the screen you are in, returning you to Excel.

Everything else will take care of itself.

I suspect that you really don't need to protect the code, because the
average user will have no idea where to look or what to look for. But if you
need to follow the instructions for that before you save and close the VBA
window.


If any of this is helpful, please click the Yes button.
--
Thanks,
Shane Devenshire


"sudarsan" wrote:

Hi,

Thanks for the code, I don't know why sometimes it s not working.Do i need
run the macro everytime?

Thanks in advance.





"Gord Dibben" wrote:

Enter this code in Thisworkbook module.

Private Sub Workbook_Open()
With Worksheets("Sheet1") 'adjust for your sheet name
.Protect Password:="justme", userinterfaceonly:=True
.EnableOutlining = True
End With
End Sub

Note; the outliing must be applied prior to saving and
re-opening.

To hide the code go to VBE and select ToolsVBA
ProjectPropertiesProtectionLock Project For Viewing.

Supply a password.


Gord Dibben MS Excel MVP


On Thu, 16 Oct 2008 23:37:01 -0700, sudarsan
wrote:

Hi,

Please suggest is there any way out to protect the sheet, when the sheet is
having column grouping / row grouping.

I want users not to see the code, unless i protect the sheet it won't
happen.Hope there will be a solution for this problem.

Thanks in advance.



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 to name many rows by values in a column on the same sheet at o Dima Excel Discussion (Misc queries) 11 August 13th 08 07:42 AM
How to name many rows by values in a column on the same sheet at o Dima Excel Worksheet Functions 8 August 13th 08 07:42 AM
Protect sheet but hide rows? FTM Excel Discussion (Misc queries) 7 March 29th 08 04:24 PM
Need to password protect work sheet and unhide rows. Nicholas Excel Discussion (Misc queries) 2 October 5th 07 06:44 PM
Protect Workbook Vs Protect Sheet Poor_pakistani New Users to Excel 4 May 25th 06 02:06 PM


All times are GMT +1. The time now is 04:07 AM.

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

About Us

"It's about Microsoft Excel"