+ Reply to Thread
Results 1 to 8 of 8

data validation and copy/paste.......

  1. #1
    MPR
    Guest

    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. #2
    Norman Jones
    Guest

    Re: data validation and copy/paste.......

    Hi MPR,

    See Tom Ogilvy's suggsetion:

    http://tinyurl.com/ovmhn


    ---
    Regards,
    Norman



    "MPR" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #3
    MPR
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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. #4
    MPR
    Guest

    RE: 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


  5. #5
    MPR
    Guest

    RE: 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


  6. #6
    MPR
    Guest

    RE: 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


  7. #7
    MPR
    Guest

    RE: 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


  8. #8
    MPR
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1