Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

drop down protection

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Drop Down protection

Drop Down protection

ResolvedVersion 2010

Warren has attended:
Excel Advanced course

Drop Down protection

How do you prevent a user copying and pasting a value over a drop-down?

RE: Drop Down protection

Hi Warren,

This has been a problem since Excel began! Pasting values over the top will remove data validation. If a cell can be edited, then pasting can break it. This is due to Excel functioning as a data analytical programme not as a Database program such as Access.

There is a work around using VBA code to constantly check the sheet for changes.

It would look something like this

Private Sub Worksheet_Change(ByVal Target As Range)
'Does the validation range still have validation?
If HasValidation(Range("DataValidationRange")) Then
Exit Sub
Else
Application.Undo
MsgBox "Error: You cannot paste data into these cells." & _
"Please use the drop-down to enter data instead.", 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


Kind regards

Richard Bailey
Microsoft Certified Trainer

Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Wed 7 Sep 2016: Automatically marked as resolved.

Excel tip:

Repeating headings on spreadsheets that print on more than one page

By default when you print a spreadsheet out and it prints on more than one page, the headings at the top and the side of the spreadsheet don't appear on all the pages following page 1.

To get Excel to repeat headings on all pages when printing, go to File - Page Setup - Sheet, then select the rows to repeat at the top of pages, and the columns to repeat at the side of pages by clicking on the red arrows at the right side of the two boxes under the 'Print titles' area. Then click OK.

If you view your spreadsheet in Print Preview, you should see the headings being repeated on each page.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.27 secs.