Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Data Validation - Do not want to allow pasting into the cell

How can a cell with a data validation drop down box not allow users to paste
into the cell. When they paste, it allows values not in the drop-down list.
However the user cannot free-type into the cell anything not in the drop-down
list.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Data Validation - Do not want to allow pasting into the cell

On Nov 19, 8:41*pm, MFTiger wrote:

probably, box itself is limited to the list
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Data Validation - Do not want to allow pasting into the cell

Hi,

That's a shortcoming of data validation that you will have to live with, no
workaround AFAIK.


Mike

"MFTiger" wrote:

How can a cell with a data validation drop down box not allow users to paste
into the cell. When they paste, it allows values not in the drop-down list.
However the user cannot free-type into the cell anything not in the drop-down
list.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Data Validation - Do not want to allow pasting into the cell

If you are happy to use a macro you may be able to use Worksheet_Change event
to test user input.

Following code not tested but something along these lines may do what you
want:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim Found As Range

With Target
'row / col of validation list
'change as required
If .Column = 6 And .Row = 7 And .Value < "" Then

'list range
'change as required
Set rng = Range("C7:C12")

Set Found = rng.Find(Target.Value)

If Found Is Nothing Then

MsgBox "Input Not Valid"

With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=$C$7:$C$12" 'change as
required
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Input Not Valid"
.ShowInput = True
.ShowError = True
End With
.ClearContents
End If
End If
End With
End Sub

it's a bit messy perhaps others may be able to offer a cleaner solution.
--
jb


"MFTiger" wrote:

How can a cell with a data validation drop down box not allow users to paste
into the cell. When they paste, it allows values not in the drop-down list.
However the user cannot free-type into the cell anything not in the drop-down
list.

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
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
Data validation vs. cutting pasting Illya Teideman Excel Discussion (Misc queries) 0 August 22nd 07 12:32 PM
Data validation when pasting data [email protected] Excel Programming 2 January 17th 07 05:20 PM
Why does data validation not work when pasting data into a cell. rjshelby Excel Discussion (Misc queries) 1 July 31st 06 09:08 PM
Pasting on Filtered Data Sheets without pasting onto hidden cells CCSMCA Excel Discussion (Misc queries) 1 August 28th 05 01:22 PM


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