Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Prevent user from amending data

I have a sheet which has to remain unprotected.

Column A on this sheet is made up of the numbers 1, 2 and 3 (on their own).

A
1 1
2 1
3 1
4 1
5 2
6 2
7 2
8 3

What I need to do is prevent users changing any of these values, the sheet
cannot be protected.

Any suggestions gratefully received.

Gareth


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Prevent user from amending data

Give your range of cells that should be "protected" a nice name. (I used
Protected.)

Then right click on the worksheet tab that should have this behavior and select
View Code. Paste this in:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Me.Range("Protected")) Is Nothing Then
Exit Sub
End If

On Error GoTo errHandler:
With Application
.EnableEvents = False
.Undo
End With

errHandler:
Application.EnableEvents = True

End Sub


If the user opens the workbook with macros disabled (or just turns off event
handling), then it fails miserably.

Gareth wrote:

I have a sheet which has to remain unprotected.

Column A on this sheet is made up of the numbers 1, 2 and 3 (on their own).

A
1 1
2 1
3 1
4 1
5 2
6 2
7 2
8 3

What I need to do is prevent users changing any of these values, the sheet
cannot be protected.

Any suggestions gratefully received.

Gareth


--

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 Tab from User Delete Ardy Excel Worksheet Functions 2 September 9th 09 02:38 PM
How do I prevent a user from entering data in a cell? jaydub100 Excel Discussion (Misc queries) 1 August 25th 09 03:14 AM
Prevent user from using Name Matlock Excel Discussion (Misc queries) 5 March 13th 08 04:58 AM
Prevent User Seeing Data in Hidden Columns Louise Excel Discussion (Misc queries) 1 October 9th 06 04:01 PM
Prevent user from disabling macros Michael Monteiro Excel Programming 0 August 21st 03 04:28 AM


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