+ Reply to Thread
Results 1 to 2 of 2

Another Data Validation question:Error message

  1. #1
    Jeff
    Guest

    Another Data Validation question:Error message

    Hello,

    With Range("e5").Validation
    .Add Type:=xlValidateWholeNumber, _
    AlertStyle:=xlValidAlertInformation, _
    Minimum:="5", Maximum:="10"
    .InputTitle = "Integers"
    .ErrorTitle = "Integers"
    .InputMessage = "Enter an integer from five to ten"
    .ErrorMessage = "You must enter a number from five to ten"
    End With

    This above code will Add Data Validation to a Cell.

    Is their a way to then retrieve back what Type it is ?

    For example from the above code it is being set to the Type of
    "xlValidateWholeNumber". How can this later on be retreived so I can tell
    what type it is ?

    Something like strType = Cells(5,5).Validation.Type
    'Notes this does not work but something like this is what I am looking for.

    Any help would be greatly appreciated.

    Thank you,
    Jeff




  2. #2
    Jim Thomlinson
    Guest

    re: Another Data Validation question:Error message

    You can get the type but it will come back as the number represented by the
    constant. Whole number 1, Decimal 2, ...

    Sub test()

    MsgBox ActiveSheet.Range("E5").Validation.Type
    End Sub
    --
    HTH...

    Jim Thomlinson


    "Jeff" wrote:

    > Hello,
    >
    > With Range("e5").Validation
    > .Add Type:=xlValidateWholeNumber, _
    > AlertStyle:=xlValidAlertInformation, _
    > Minimum:="5", Maximum:="10"
    > .InputTitle = "Integers"
    > .ErrorTitle = "Integers"
    > .InputMessage = "Enter an integer from five to ten"
    > .ErrorMessage = "You must enter a number from five to ten"
    > End With
    >
    > This above code will Add Data Validation to a Cell.
    >
    > Is their a way to then retrieve back what Type it is ?
    >
    > For example from the above code it is being set to the Type of
    > "xlValidateWholeNumber". How can this later on be retreived so I can tell
    > what type it is ?
    >
    > Something like strType = Cells(5,5).Validation.Type
    > 'Notes this does not work but something like this is what I am looking for.
    >
    > Any help would be greatly appreciated.
    >
    > Thank you,
    > Jeff
    >
    >
    >


+ 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