Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Password protect parts of worksheet

I have macros on a spreadsheet/worksheet that does some calculations.
I have protected certain columns that have formulas and that seems to be ok
until I want to press my macro button and have it do additional calculations
or print.
But since I have the worksheet protected, how can I also 'unprotect' the
macro button to all this?
i.e. Column E is protected and I set the Tools/Protection/worksheet password
protected. I have several macro buttons that does various things. When I
click on these buttons, I get an error stating that they can not be run
because the worksheet is protected.
How can I protect my formulas and allow the macro buttons to work?
or
thx
dwebb
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Password protect parts of worksheet

Hi ddwebb

You can unprotect your sheet in the code
and protect it again after your code is ready.

But I like this way.

Protect your worksheets with code like this
Copy this in the Thisworkbook module.
The macro's will be working now

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ABCD", , , userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl


"ddwebb" wrote in message ...
I have macros on a spreadsheet/worksheet that does some calculations.
I have protected certain columns that have formulas and that seems to be ok
until I want to press my macro button and have it do additional calculations
or print.
But since I have the worksheet protected, how can I also 'unprotect' the
macro button to all this?
i.e. Column E is protected and I set the Tools/Protection/worksheet password
protected. I have several macro buttons that does various things. When I
click on these buttons, I get an error stating that they can not be run
because the worksheet is protected.
How can I protect my formulas and allow the macro buttons to work?
or
thx
dwebb



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Password protect parts of worksheet

Do I have to mention the name of the worksheet or the columns I want
protected? For a dude that is not a programmer, I am muddling thru this and
trying to learn.
What is ABCD, is that a value I need to change?
Or ThisWorkBook?
dougw

"Ron de Bruin" wrote:

Hi ddwebb

You can unprotect your sheet in the code
and protect it again after your code is ready.

But I like this way.

Protect your worksheets with code like this
Copy this in the Thisworkbook module.
The macro's will be working now

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ABCD", , , userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl


"ddwebb" wrote in message ...
I have macros on a spreadsheet/worksheet that does some calculations.
I have protected certain columns that have formulas and that seems to be ok
until I want to press my macro button and have it do additional calculations
or print.
But since I have the worksheet protected, how can I also 'unprotect' the
macro button to all this?
i.e. Column E is protected and I set the Tools/Protection/worksheet password
protected. I have several macro buttons that does various things. When I
click on these buttons, I get an error stating that they can not be run
because the worksheet is protected.
How can I protect my formulas and allow the macro buttons to work?
or
thx
dwebb




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Password protect parts of worksheet

Names: My worksheet name is: CheckIn
Columns want protected: L, T, U, and V
thx
dw

"ddwebb" wrote:

Do I have to mention the name of the worksheet or the columns I want
protected? For a dude that is not a programmer, I am muddling thru this and
trying to learn.
What is ABCD, is that a value I need to change?
Or ThisWorkBook?
dougw

"Ron de Bruin" wrote:

Hi ddwebb

You can unprotect your sheet in the code
and protect it again after your code is ready.

But I like this way.

Protect your worksheets with code like this
Copy this in the Thisworkbook module.
The macro's will be working now

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ABCD", , , userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl


"ddwebb" wrote in message ...
I have macros on a spreadsheet/worksheet that does some calculations.
I have protected certain columns that have formulas and that seems to be ok
until I want to press my macro button and have it do additional calculations
or print.
But since I have the worksheet protected, how can I also 'unprotect' the
macro button to all this?
i.e. Column E is protected and I set the Tools/Protection/worksheet password
protected. I have several macro buttons that does various things. When I
click on these buttons, I get an error stating that they can not be run
because the worksheet is protected.
How can I protect my formulas and allow the macro buttons to work?
or
thx
dwebb




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Password protect parts of worksheet

Hi

You lock/unlock the cells you want the normal way.
This event will protect all worksheets for you in the workbook.
It use userinterfaceonly in the protect line to keep your macro's working.

ABCD = the password of the worksheets(you can change it


For a dude that is not a programmer, I am muddling thru this


Try it first on a test workbook

Right click on the Excel icon next to File in the Worksheet menu bar
Choose view code
Paste this event there
Alt-q to go back to Excel

Save/close/reopen the workbook



--
Regards Ron de Bruin
http://www.rondebruin.nl


"ddwebb" wrote in message ...
Do I have to mention the name of the worksheet or the columns I want
protected? For a dude that is not a programmer, I am muddling thru this and
trying to learn.
What is ABCD, is that a value I need to change?
Or ThisWorkBook?
dougw

"Ron de Bruin" wrote:

Hi ddwebb

You can unprotect your sheet in the code
and protect it again after your code is ready.

But I like this way.

Protect your worksheets with code like this
Copy this in the Thisworkbook module.
The macro's will be working now

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ABCD", , , userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl


"ddwebb" wrote in message ...
I have macros on a spreadsheet/worksheet that does some calculations.
I have protected certain columns that have formulas and that seems to be ok
until I want to press my macro button and have it do additional calculations
or print.
But since I have the worksheet protected, how can I also 'unprotect' the
macro button to all this?
i.e. Column E is protected and I set the Tools/Protection/worksheet password
protected. I have several macro buttons that does various things. When I
click on these buttons, I get an error stating that they can not be run
because the worksheet is protected.
How can I protect my formulas and allow the macro buttons to work?
or
thx
dwebb








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Password protect parts of worksheet

Thanks. That seems to be working.
Now to put into production and let the staff find a problem.
dw

"Ron de Bruin" wrote:

Hi

You lock/unlock the cells you want the normal way.
This event will protect all worksheets for you in the workbook.
It use userinterfaceonly in the protect line to keep your macro's working.

ABCD = the password of the worksheets(you can change it


For a dude that is not a programmer, I am muddling thru this


Try it first on a test workbook

Right click on the Excel icon next to File in the Worksheet menu bar
Choose view code
Paste this event there
Alt-q to go back to Excel

Save/close/reopen the workbook



--
Regards Ron de Bruin
http://www.rondebruin.nl


"ddwebb" wrote in message ...
Do I have to mention the name of the worksheet or the columns I want
protected? For a dude that is not a programmer, I am muddling thru this and
trying to learn.
What is ABCD, is that a value I need to change?
Or ThisWorkBook?
dougw

"Ron de Bruin" wrote:

Hi ddwebb

You can unprotect your sheet in the code
and protect it again after your code is ready.

But I like this way.

Protect your worksheets with code like this
Copy this in the Thisworkbook module.
The macro's will be working now

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ABCD", , , userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub




--
Regards Ron de Bruin
http://www.rondebruin.nl


"ddwebb" wrote in message ...
I have macros on a spreadsheet/worksheet that does some calculations.
I have protected certain columns that have formulas and that seems to be ok
until I want to press my macro button and have it do additional calculations
or print.
But since I have the worksheet protected, how can I also 'unprotect' the
macro button to all this?
i.e. Column E is protected and I set the Tools/Protection/worksheet password
protected. I have several macro buttons that does various things. When I
click on these buttons, I get an error stating that they can not be run
because the worksheet is protected.
How can I protect my formulas and allow the macro buttons to work?
or
thx
dwebb






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
Is there a way that I can password protect a worksheet Lin4it Excel Worksheet Functions 3 November 27th 08 03:37 PM
Password Protect a Worksheet joinme4coffee Excel Discussion (Misc queries) 8 October 28th 07 07:02 PM
Protect a worksheet with a password colettey29 Excel Worksheet Functions 2 September 26th 06 05:51 PM
password protect worksheet Ben Excel Discussion (Misc queries) 3 February 14th 06 02:30 PM
Password Protect Worksheet Viewing ByTheLake Excel Programming 1 July 22nd 04 06:45 PM


All times are GMT +1. The time now is 09:51 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"