Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default prevent user from selecting and changing a sheet

I have written a database front end with Excel that uses some built in Excel
functions. One thing I use is a sheet to store intermediate variables, user
settings and so on. This sheet needs to be updated programatically, but I
don't want the user to accidentally change anything.

I could go through the code and protect and hide then unprotect and unhide
the sheet as the programs need to interact with the sheet but this seems
messy and I don't want the user to see the sheets changing. Is there a way
to keep the sheet open and available to the programs without allowing the
user to select the sheet or change its contents?

Any thoughts would be appreciated.

TIA

Dan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default prevent user from selecting and changing a sheet

Your program may be able to do everything it needs to do without the sheet being
visible. If your code selects ranges, work on that range directly:

instead of:

with worksheets("Hidden")
.visible = true
.unprotect password:="Hi"
.range("a1").select
activecell.value = "it changed"
.protect password:="Hi"
.visible = xlsheethidden
end with

You could keep it hidden (and maybe unprotected???):

with worksheets("Hidden")
.range("a1").value = "it changed"
end with

===
You could also protect the worksheet in code that allows the worksheet to be
changed by code--but not by the user:

Option Explicit
Sub auto_open()
With Worksheets("Hidden")
.Protect Password:="Hi", userinterfaceonly:=True
End With
End Sub

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

dirt wrote:

I have written a database front end with Excel that uses some built in Excel
functions. One thing I use is a sheet to store intermediate variables, user
settings and so on. This sheet needs to be updated programatically, but I
don't want the user to accidentally change anything.

I could go through the code and protect and hide then unprotect and unhide
the sheet as the programs need to interact with the sheet but this seems
messy and I don't want the user to see the sheets changing. Is there a way
to keep the sheet open and available to the programs without allowing the
user to select the sheet or change its contents?

Any thoughts would be appreciated.

TIA

Dan


--

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
Prevent user changing pivot chart layout Jessica Excel Worksheet Functions 0 April 15th 06 12:24 AM
Prevent User to unlock Sheet Tabs Param Excel Worksheet Functions 2 March 23rd 06 01:45 AM
Prevent selecting locked cells Andy Excel Programming 6 October 14th 04 01:41 PM
prevent user to rename sheet caroline Excel Programming 4 May 17th 04 01:29 PM
How to Prevent User from Unhiding Sheet Bruce B[_2_] Excel Programming 4 September 17th 03 10:01 AM


All times are GMT +1. The time now is 05:02 AM.

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"