Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Validation fails on copying

Hi, forum
I've got a problem on the validation. Actually, The validation works fine
when I type in any info.
However, when I auto fill the list using dropdown function or I copy any
info from some where else, the validation totally dfailed ! Can anybody
tells me how could this happen ? What should I do to keep the validation
rules when copying ?

thanks in advance ~!

niou
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Validation fails on copying

It's a known fact that copy-paste or dragging down will defeat data
validation (DV).

If you're trying to prevent duplicate entries using DV, then you could try
Vasant's code below, which will prevent duplicate entries -- including
preventing copy-paste or dragging which would defeat data validation -- for
col A in a sheet. Entries are assumed made progressively from row1 down.

To install the code, right-click on the worksheet tab, select View Code,
then copy and paste the code below into the white space on the right. Press
Alt+Q to return to Excel. Test it out ..

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
' Vasant Nanavati 2002
On Error GoTo ErrorHandler
If Not Intersect(Target, Columns(1)) Is Nothing Then
If Not Range(Cells(1, 1), Cells(Intersect _
(Target, Columns(1)).Row - 1, 1)).Find _
(Target.Value, LookIn:=xlValues, LookAt:= _
xlWhole) Is Nothing Then
MsgBox "Part no. already exists!"
Application.EnableEvents = False
With Intersect(Target, Columns(1))
.ClearContents
.Select
End With
End If
End If
ErrorHandler:
Application.EnableEvents = True
End Sub
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"x6v87qe" wrote:
Hi, forum
I've got a problem on the validation. Actually, The validation works fine
when I type in any info.
However, when I auto fill the list using dropdown function or I copy any
info from some where else, the validation totally dfailed ! Can anybody
tells me how could this happen ? What should I do to keep the validation
rules when copying ?

thanks in advance ~!

niou

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Validation fails on copying

Thanks max for you quick response. That code works fine for preventing dups.
The entries I have does have some dups. It seems I have to accept the fact :(

"Max" wrote:

It's a known fact that copy-paste or dragging down will defeat data
validation (DV).

If you're trying to prevent duplicate entries using DV, then you could try
Vasant's code below, which will prevent duplicate entries -- including
preventing copy-paste or dragging which would defeat data validation -- for
col A in a sheet. Entries are assumed made progressively from row1 down.

To install the code, right-click on the worksheet tab, select View Code,
then copy and paste the code below into the white space on the right. Press
Alt+Q to return to Excel. Test it out ..

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
' Vasant Nanavati 2002
On Error GoTo ErrorHandler
If Not Intersect(Target, Columns(1)) Is Nothing Then
If Not Range(Cells(1, 1), Cells(Intersect _
(Target, Columns(1)).Row - 1, 1)).Find _
(Target.Value, LookIn:=xlValues, LookAt:= _
xlWhole) Is Nothing Then
MsgBox "Part no. already exists!"
Application.EnableEvents = False
With Intersect(Target, Columns(1))
.ClearContents
.Select
End With
End If
End If
ErrorHandler:
Application.EnableEvents = True
End Sub
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"x6v87qe" wrote:
Hi, forum
I've got a problem on the validation. Actually, The validation works fine
when I type in any info.
However, when I auto fill the list using dropdown function or I copy any
info from some where else, the validation totally dfailed ! Can anybody
tells me how could this happen ? What should I do to keep the validation
rules when copying ?

thanks in advance ~!

niou

  #4   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Validation fails on copying

welcome, niou.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"x6v87qe" wrote in message
...
Thanks max for you quick response. That code works fine for preventing
dups.
The entries I have does have some dups. It seems I have to accept the fact
:(



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
Cell value fails to recalculate PSW2000 Excel Discussion (Misc queries) 2 March 16th 06 02:09 AM
excel fails to launch NFEI Excel Discussion (Misc queries) 3 October 31st 05 08:13 PM
VBA Formula Fails to Execute Patrice Stewart Setting up and Configuration of Excel 1 August 24th 05 09:45 PM
Autorefresh Fails on Open STEVE Excel Discussion (Misc queries) 0 December 20th 04 10:23 PM
Updating Chart fails Frank Schuberth Charts and Charting in Excel 1 December 15th 04 01:46 PM


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