+ Reply to Thread
Results 1 to 3 of 3

User Form Data Validation

  1. #1
    MBlake
    Guest

    User Form Data Validation

    How, Please could someone point me to a good tutorial on data validation for
    user forms?. I have a workbook that uses the INDIRECT method to restrict
    options dependant on the first selection. I want to create a user form for
    data entry, if I use the Excel data form from the menu bar, the data
    validation is not carried across.

    A url to advice would be great,
    Thanks,
    Mickey



  2. #2
    Dave Peterson
    Guest

    Re: User Form Data Validation

    Are you using a combobox on that userform?

    Instead of using =indirect() in the userform, I just used code to point at that
    other range.

    I put two comboboxes and two commmand buttons (ok/cancel) on a userform.

    This is the code I had behind it:

    Option Explicit
    Private Sub ComboBox1_Change()

    Dim myList As Variant
    Select Case LCase(Me.ComboBox1.Value)
    Case Is = "$a$1": myList = Worksheets("sheet1").Range("b1:b10").Value
    Case Is = "$a$2": myList = Worksheets("sheet1").Range("c1:c10").Value
    Case Is = "$a$3": myList = Worksheets("sheet1").Range("d1:d10").Value
    End Select

    With Me.ComboBox2
    .List = myList
    .ListIndex = -1
    End With

    End Sub
    Private Sub CommandButton1_Click()
    Unload Me
    End Sub
    Private Sub UserForm_Initialize()
    With Me.ComboBox1
    .Style = fmStyleDropDownList
    .List = Worksheets("sheet1").Range("a1:a3").Value
    End With

    Me.ComboBox2.Style = fmStyleDropDownList
    End Sub

    Maybe you could play with this and get a few ideas???

    MBlake wrote:
    >
    > How, Please could someone point me to a good tutorial on data validation for
    > user forms?. I have a workbook that uses the INDIRECT method to restrict
    > options dependant on the first selection. I want to create a user form for
    > data entry, if I use the Excel data form from the menu bar, the data
    > validation is not carried across.
    >
    > A url to advice would be great,
    > Thanks,
    > Mickey


    --

    Dave Peterson

  3. #3
    MBlake
    Guest

    Re: User Form Data Validation

    Thanks Dave,
    I'll play around with the code, I appreciate your help.

    Mickey



+ 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