none
[Help] Data Validation through VBA RRS feed

  • Question

  • I have set up a sheet as a form to enter details that I want to save and print. The details are regarding cheque tracking and I want all the heads in the form to be filled with data. This data need to be populated to another sheet using a command button that prints the range and populates the details in sheet2 under appropriate head.

    I have the data population part set, but I do not know how to enforce a code which asks users to complete all the relevant details and then only be able to populate the details to sheet 2

    Anyway to do it ?

    Tuesday, August 16, 2016 10:12 AM

Answers

  • Hi huzzug,

    you had mentioned that,"I have set up a sheet as a form to enter details that I want to save and print."

    did you created a user form and from that you want to enter the data in the sheet or you had put the textbox controls on the sheet itself and you are using that sheet as a form?

    you had mentioned that,"I want all the heads in the form to be filled with data"

    Heads means Textbox in the Form?

    you had mentioned that ,"I have the data population part set, but I do not know how to enforce a code which asks users to complete all the relevant details and then only be able to populate the details to sheet 2"

    from the line above it looks like you had done the code about inserting the data and only want to check for empty data and want to allow insert the data in sheet when all textbox are filled.

    you can try to use the code below to check if textbox have data or not.

    so here I assume that you are using an UserForm.

    Private Sub CommandButton1_Click()
    If Me.TextBox1.Text = "" Then
    MsgBox "Enter the Data in TextBox-1"
    Me.TextBox1.SetFocus
    Else
    MsgBox "Data is availabe in TextBox-1"
    End If
    End Sub
    

    here I only check the data is available or not. further you can also modify the code to check for specific data. like you want only numeric data or you want the data in particular format etc.

    you will get result like below.

    still if you have any question regarding this then let me know.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, August 17, 2016 2:32 AM
    Moderator