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: 118
Default John Walkenbach - Ensuring that Data Validation is Not Deleted

Private Sub Worksheet_Change(ByVal Target As Range)
'Does the validation range still have validation?
If HasValidation(Range("ValidationRange")) Then
Exit Sub
Else
Application.Undo
MsgBox "Your last operation was canceled." & _
"It would have deleted data validation rules.", vbCritical
End If
End Sub

Private Function HasValidation(r) As Boolean
' Returns True if every cell in Range r uses Data Validation
On Error Resume Next
x = r.Validation.Type
If Err.Number = 0 Then HasValidation = True Else HasValidation =
False
End Function

The macro do not work if copied cells already contain validation -
specially if my range is a column & user will copy cells from the
column.

Can anybody help

 
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
to: John Walkenbach - Face ID add-in STEVE BELL Excel Programming 0 September 12th 05 07:12 PM
John Walkenbach Color Palette (Repost) ExcelMonkey Excel Programming 1 July 15th 05 02:50 PM
John Walkenbach Color Palette ExcelMonkey Excel Programming 0 July 14th 05 04:17 PM
Ensuring deleted data cannot be recovered Jell Excel Discussion (Misc queries) 3 July 3rd 05 03:11 PM
John Walkenbach Colour Palette ExcelMonkey[_190_] Excel Programming 1 March 20th 05 07:23 PM


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