LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Protecting a Range in a list

Whats wrong with this code? I am using it on a sheet that has an Excel
list. I cant protect the worksheet as it makes the list inactive. The
code gives the user a message and applys an undo whenever they attempt
to type over a formula. I'm trying to allow the users to delete whole
rows and using this code "If Target.Columns.Count = Columns Then". If I
take the delete rows bit out everything works fine, with it in it works
okay but slows the spreadsheet down massivley making it unworkable.

Here is the code:

Dim myRng As Range
Set myRng = Me.Range("Protect")


On Error GoTo errHandler:
If Intersect(Target, myRng) Is Nothing Then
'let 'em do it


Else
With Application
.EnableEvents = False
.Undo
End With
MsgBox "I've asked you not to change this Field!"
End If

On Error GoTo errHandler:
If Target.Columns.Count = Columns Then

Else
With Application
.EnableEvents = False
.Undo
End With
MsgBox "I've asked you not to change this Field!"

End If

errHandler:
Application.EnableEvents = True


End Sub

 
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
List with total row and protecting Mel Excel Worksheet Functions 0 July 17th 07 05:12 PM
Protecting a sheet with a list on it aneasiertomorrow Excel Discussion (Misc queries) 3 May 11th 07 12:22 AM
Protecting an Excel List John Excel Programming 2 September 14th 06 03:32 PM
Protecting a Used Range Paige Excel Programming 2 March 16th 06 12:16 AM
Protecting a worksheet containing XML List John Allison Excel Discussion (Misc queries) 0 November 10th 05 10:07 AM


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