Macro Intro
This is an Excel macro that generates a custom questionnaire to complete. The Role field is used to determine what questions display for specific users. The Role selection options can be customized directly in the Roles Worksheet. Once a user selects their Role, they can click Generate to see what questions they need to complete to finish the questionnaire. Certain questions can display for specific Roles by indicating the questions number in the columns adjacent to a specific role in the Roles Worksheet. This helps ensures that only the questions that are necessary for users are completed. The questions and answers can be customized by updating the Questions Worksheet. Three questions types exist: Yes/No, List, and Free Text and can be set in the second row of the Questions Worksheet. When creating a List question enter the answers in the rows below. After a user has completed all the required questions, they can click Finish to create a separate Excel Workbook with all the populated answers. This new Excel Workbook will be saved to the same location as the Active Workbook. You can customize where this new file is saved making it easy to know when someone has completed a questionnaire and is awaiting review. By Default, the new Excel Workbook file name will be the Role selected followed by the Date and Time. There is also the option to send this separate Excel Workbook in an Outlook email with a couple updates to the VBA code. There is always a better way with VBA and this Excel macro helps standardize the collection of answers to specific questions. This can help lead to a more formal review process and eliminate mistakes. It is easy to restrict access to edit this questionnaire by protecting the Roles and Questions Worksheets with a password. To do this navigate to the Review tab and click the Protect Sheet button.Use the following link to download the Excel Workbook seen in the videos below: Excel Custom Questionnaire to File
See it in Action
Watch this video to see this macro in action.Code
Here is the code for this macro. Make sure the following References are setup before running it: Visual Basic For Applications, Microsoft Excel 16.0 Object LibraryCustomization
These segments of code can be customized to personalize this macro.Set the Answer column to No Fill
Populate the Answer field for Free Text Questions
The File Path where the New .xlsx Workbook will be saved. By Default, it will be saved to the Active Workbook’s file path
The File Name of the New .xlsx Workbook. By Default, it will be in the following format: SelectedRoleName_mm.dd.yyyy_hhmm.xlsx
Remove the ‘ from the following code lines to generate an email with the New .xlsx Workbook as an attachment
Enter in an email address for the To recipient field
Enter in text for the Subject field
Enter in text for the Email Body
Include the New .xlsx Workbook as an email attachment
Display the email before sending. (HIGHLY RECOMMENDED to automatically send this email without displaying it)
Send the email after the completion of the questionnaire
The Message Box that displays when someone completes the questionnaire