Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Workbook Protect/Unprotect Strategy question

1. A user opens the file. An auto macro runs, locking cells and hiding
pages I want hidden,


If you distribute the workbook to users in a prepped condition why would you
need to do this?

The rest is fine but generally it's not necessary to unhide worksheets to do
something to them - if you do it the right way, that is, without
"selecting". Here's an example of what I mean:

Rookie code:
Application.ScreenUpdating = False
Worksheets("Whatever").Visible = True
Range("A1").Select
X = ActiveCell.Value
Worksheets("Whatever").Visible = False

Pro code:
X = Worksheets("Whatever").Range("A1").Value

--
Jim
"RAP" wrote in message
...
| Hello,
| I have an Excel file with many pages. I need to hide all but about 3
pages
| for my "users." Right now, many of my macros will not run when the pages
are
| hidden and/or protected. If that's the way Excel works, so be it. No
| problem.
| My question is in regards to a strategy to give the appearance I'm
seeking,
| but stay within the confines of Excel functionality.
|
| What scripting would give me the following ability:
| 1. A user opens the file. An auto macro runs, locking cells and hiding
| pages I want hidden, so only the pages I want him/her to see are visible.
I
| don't want the user to be able to get into the pages and accidentaly
change
| formulas, etc... I do not have a "confidential information" situation,
just
| for protection of the forumlas and macros and to keep the file "clean &
| uncomplicated"-looking for the user.
| 2. When a button is clicked to start a macro, have the macro first do the
| following:
| a. ScreenUpdating = false
| b. unhide sheets (in order for macros to run: just necessary sheets or all
| sheets)
| c. unlock any cells needed to run the macro (may not need this if sheets
| can be re-hidden before macro finishes)
| d. perform macro's function
| e. lock cells back
| f. hide sheets
| g. ScreenUpdating = True
| h. Exit Sub
|
| I don't know if this is a legitimate way to achieve my program design
goal.
| If there is another tact I need to take, please let me know.
| Thank you,
| Randy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Workbook Protect/Unprotect Strategy question

Thanks for the pro method. I hate it when my rookie shows his face! :)

"Jim Rech" wrote:

1. A user opens the file. An auto macro runs, locking cells and hiding
pages I want hidden,


If you distribute the workbook to users in a prepped condition why would you
need to do this?

The rest is fine but generally it's not necessary to unhide worksheets to do
something to them - if you do it the right way, that is, without
"selecting". Here's an example of what I mean:

Rookie code:
Application.ScreenUpdating = False
Worksheets("Whatever").Visible = True
Range("A1").Select
X = ActiveCell.Value
Worksheets("Whatever").Visible = False

Pro code:
X = Worksheets("Whatever").Range("A1").Value

--
Jim
"RAP" wrote in message
...
| Hello,
| I have an Excel file with many pages. I need to hide all but about 3
pages
| for my "users." Right now, many of my macros will not run when the pages
are
| hidden and/or protected. If that's the way Excel works, so be it. No
| problem.
| My question is in regards to a strategy to give the appearance I'm
seeking,
| but stay within the confines of Excel functionality.
|
| What scripting would give me the following ability:
| 1. A user opens the file. An auto macro runs, locking cells and hiding
| pages I want hidden, so only the pages I want him/her to see are visible.
I
| don't want the user to be able to get into the pages and accidentaly
change
| formulas, etc... I do not have a "confidential information" situation,
just
| for protection of the forumlas and macros and to keep the file "clean &
| uncomplicated"-looking for the user.
| 2. When a button is clicked to start a macro, have the macro first do the
| following:
| a. ScreenUpdating = false
| b. unhide sheets (in order for macros to run: just necessary sheets or all
| sheets)
| c. unlock any cells needed to run the macro (may not need this if sheets
| can be re-hidden before macro finishes)
| d. perform macro's function
| e. lock cells back
| f. hide sheets
| g. ScreenUpdating = True
| h. Exit Sub
|
| I don't know if this is a legitimate way to achieve my program design
goal.
| If there is another tact I need to take, please let me know.
| Thank you,
| Randy



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
Protect/unprotect ALL worksheets in workbook ? Newsgal Excel Discussion (Misc queries) 5 May 4th 10 06:20 PM
Protect/Unprotect workbook Vitordf Excel Discussion (Misc queries) 2 April 25th 09 12:51 PM
Can I unprotect / protect a shared workbook? Florence Excel Programming 8 August 17th 05 04:08 PM
Macros for Protect/Unprotect all sheets in a workbook Paul Sheppard[_2_] Excel Programming 4 August 16th 05 03:36 PM
Protect/Unprotect ALL and/or SPECIFIED Worksheets in Workbook snsd[_5_] Excel Programming 1 November 12th 04 05:51 PM


All times are GMT +1. The time now is 09:45 PM.

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"