Thread: Validate issue
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Validate issue

Pablo,

In the VBE, with the project active, use Tools / References, and look for "Microsoft Forms 2.0
Object Library", and put a check next to it.

HTH,
Bernie
MS Excel MVP


"pablo bellissimo" wrote in message
...
Hi Bernie,

This is looking good so far but I'm not sure what you mean about the MS
Forms 2.0 Object Library?? How do I make that bit work?

"Bernie Deitrick" wrote:

Oooops...... I forgot to mention that this requires a reference to MS Forms 2.0 Object
Library....

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Pablo,

Try this: the 13 (rather than 11) is due to extra control characters in the text string
returned
from the clipboard.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim SomeVar As String
Dim MyDataObj As New DataObject

If Intersect(Target, Range("B2:B100")) Is Nothing Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
If Application.CutCopyMode = False Then Exit Sub

MyDataObj.GetFromClipboard
SomeVar = MyDataObj.GetText()

If Left(SomeVar, 2) = "07" And Len(SomeVar) = 13 Then Exit Sub

Application.CutCopyMode = False

End Sub


"pablo bellissimo" wrote in message
...
This is very nearly what I'm looking for!

The code below will just prevent a user pasting into a cell that has has
validation rules applied to it. I would like to allow a user to paste a
value as long as it meets my data validation rules.

I only want users to be able to enter a number which is 11 digits long and
it must start with "07". I'm sure this is possible but I've not yet found
anyone able to help.

please please please try to offer me a solution - I'm getting desperate!
Thanks:)


"Steven" wrote:


I am using cell validation. I have noticed if I copy a cell from a
different area on the sheet that does not have validation it will take the
validation away from my original cell.

Why is this? How can I make it so a user cannot wipeout the validation.

Thank you for your help.

Steven