Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MPR MPR is offline
external usenet poster
 
Posts: 3
Default data validation and copy/paste.......

Have defined multiple cells with (varying) length validation rules....as
noted in other threads, data validation is not enforced when user populates
with copy/paste....since copy/paste does trgger "worksheet change" event, how
can I invoke the cells "defined" validation routine from within
"Worksheet_Change"?
My preference is to leverage the cells defined validation settings to avoid
writing individualized subroutines/logic per cell, per worksheet.....

I know using "Worksheet.CircleInvalid" does perform validation of the cells
in defined range, because the invalid ones are "circled".....problem is,
circling cell doesn't "enforce" validation restrictions.

Any/all help is greatly appreciated....

MPR
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default data validation and copy/paste.......

Hi MPR,

See Tom Ogilvy's suggsetion:

http://tinyurl.com/ovmhn


---
Regards,
Norman



"MPR" wrote in message
...
Have defined multiple cells with (varying) length validation rules....as
noted in other threads, data validation is not enforced when user
populates
with copy/paste....since copy/paste does trgger "worksheet change" event,
how
can I invoke the cells "defined" validation routine from within
"Worksheet_Change"?
My preference is to leverage the cells defined validation settings to
avoid
writing individualized subroutines/logic per cell, per worksheet.....

I know using "Worksheet.CircleInvalid" does perform validation of the
cells
in defined range, because the invalid ones are "circled".....problem is,
circling cell doesn't "enforce" validation restrictions.

Any/all help is greatly appreciated....

MPR



  #3   Report Post  
Posted to microsoft.public.excel.programming
MPR MPR is offline
external usenet poster
 
Posts: 3
Default data validation and copy/paste.......


thanks for the feedback....the idea of disabling ability to "paste" data
is appealing but not practical.....the need does exist to allow users
to paste into cells, we just need to impose the data validation rules
on the pasted data....for that reason I was (am) searching for a way
to invoke the underlying (internal) data validation routine "manually"....
my thinking was, given that "Worksheet.CircleInvalid" can flag the
cells in violation, there must be some internal subroutine or method
that is being (or can be) called.....




"Norman Jones" wrote:

Hi MPR,

See Tom Ogilvy's suggsetion:

http://tinyurl.com/ovmhn


---
Regards,
Norman



"MPR" wrote in message
...
Have defined multiple cells with (varying) length validation rules....as
noted in other threads, data validation is not enforced when user
populates
with copy/paste....since copy/paste does trgger "worksheet change" event,
how
can I invoke the cells "defined" validation routine from within
"Worksheet_Change"?
My preference is to leverage the cells defined validation settings to
avoid
writing individualized subroutines/logic per cell, per worksheet.....

I know using "Worksheet.CircleInvalid" does perform validation of the
cells
in defined range, because the invalid ones are "circled".....problem is,
circling cell doesn't "enforce" validation restrictions.

Any/all help is greatly appreciated....

MPR




  #4   Report Post  
Posted to microsoft.public.excel.programming
MPR MPR is offline
external usenet poster
 
Posts: 3
Default data validation and copy/paste.......

Unfortunately I didn't receive the feedback I was looking (hoping) for so I
had to compose a solution that still allowed users to "paste" data into cells
while still enforcing (?) the data validation schema's defined for the
targeted cells...now..while this approcah does NOT enfore the validation
schema, it does provide the user with a MSGBOX informing them the have pasted
invalid data into the cell....following is baseline script executed when
worksheet changes....

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rc As Integer
Dim celll As Range
Dim objWorksheet As Object
Set objWorksheet = ThisWorkbook.ActiveSheet
objWorksheet.ClearCircles
objWorksheet.CircleInvalid
For Each celll In Target
If Not celll.Validation.value Then
rc = MsgBox("Data Validation errors exist! " &
celll.Validation.ErrorMessage & " Please correct circled entries!",
vbCritical, "Failure")
Exit Sub
End If
Next
End Sub

Additionally, I added the following subroutine which executes when the
respective worksheet is opened (informing user worksheet contains invalid
data)...

Private Sub Worksheet_Activate()
Dim rc As Integer
Dim celll As Range
Dim objWorksheet As Object
Set objWorksheet = ThisWorkbook.ActiveSheet
objWorksheet.ClearCircles
objWorksheet.CircleInvalid
For Each celll In objWorksheet.Range("B11:B35", "G11:N35")
If Not celll.Validation.value Then
rc = MsgBox("Data Validation errors exist! Please correct circled
entries!", vbCritical, "Failure")
Exit Sub ' exit subroutine if invalid data found because
"CircleInvalid" highlights all.
End If
Next
End Sub


Again, not elegent or fool proof, but definitely makes user aware they have
pasted "invalid" data into cells......

MPR....


"MPR" wrote:

Have defined multiple cells with (varying) length validation rules....as
noted in other threads, data validation is not enforced when user populates
with copy/paste....since copy/paste does trgger "worksheet change" event, how
can I invoke the cells "defined" validation routine from within
"Worksheet_Change"?
My preference is to leverage the cells defined validation settings to avoid
writing individualized subroutines/logic per cell, per worksheet.....

I know using "Worksheet.CircleInvalid" does perform validation of the cells
in defined range, because the invalid ones are "circled".....problem is,
circling cell doesn't "enforce" validation restrictions.

Any/all help is greatly appreciated....

MPR

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
Data Validation - copy paste ! Christoffer Bloch Andersen Excel Worksheet Functions 1 March 18th 09 01:22 PM
Data Validation (copy paste error) Christoffer Bloch Andersen Excel Worksheet Functions 0 February 3rd 09 01:45 PM
Data Validation (copy paste error) Christoffer Bloch Andersen Excel Worksheet Functions 0 January 26th 09 11:53 AM
Copy Paste overides data validation jk Excel Programming 1 July 23rd 06 08:44 AM
Copy/Paste over rides data validation jk Setting up and Configuration of Excel 1 July 23rd 06 03:39 AM


All times are GMT +1. The time now is 02:52 AM.

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"