• Form – Hide Questions if answer not required according to age criteria

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Form – Hide Questions if answer not required according to age criteria

    Author
    Topic
    #499224

    I always find it difficult to give a meaningful title to my questions. I hope this one does the job.

    I have an excel form that I would like to streamline and make easier for users. There are a lot of questions that they do not need to answer according to the date of birth entered, so I would like to hide the irrelevant ones. I have looked at the validation function in Excel but I think this is more something that needs to be done in VB. I have attached a sample showing what I want to do.

    Viewing 1 reply thread
    Author
    Replies
    • #1497495

      Kerry,

      Here’s a roughed out User Form that shows how you can accomplish what you are after including:
      39993-KerryUserForm

        [*]Calculating the Age (I used a routine from the internet which is a little more accurate than your formula).
        [*]Showing either Question 1 or Question 4 in the same space below the DOB:
        [*]Providing a group where only one answer can be selected.
        [*]Saving the data back to the worksheet.
        [*]Placing a button on the worksheet to run the form.

      If this is what you’re after we can help you flesh out the rest of the solution if you are not familiar with VBA forms.

      Test File: 39992-KerryG-Validation-Sample

      HTH :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • #1497625

        Thank you so much for your response. What you and Maud have given me is a great start to work with. I will play with this over the next few days and get back to you if I have any questions. I am familiar with UserForms and can usually understand VB once written, but am not able to write it from scratch.
        Kind Regards Kerry

    • #1497507

      Kerryg,

      Since I had been working on a solution, I will post mine as well. The code accepts x or X for the checkboxes and validates any other value entered. The code will then hide the question (rows) based on the criteria you specify and will validate selections.

      HTH,
      Maud

    Viewing 1 reply thread
    Reply To: Form – Hide Questions if answer not required according to age criteria

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: