Excel Custom Questionnaire to File | VBA Macro #34

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 Library

Customization

These segments of code can be customized to personalize this macro.
The File Path where the New .xlsx Workbook will be saved. By Default, it will be saved to the Active Workbook’s file path
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
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
Search

First time using VBA?

The Developer Tab is an additional section of the ribbon when activated allows you access to Visual Basic in Applications like Access, Excel, Outlook, PowerPoint, Word.
Setup Now
Once the Developer Tab is available you will have the capability to update your security to allow Macros to run in the current application.
Setup Now
A sub of code is a collection of objects and variables. For the code to successfully run a library of references needs to be set.
Setup Now
Subscribe as an Insider to receive additional rights.
If you like our content and want to show your support tip us here!

Contact Us

Looking to improve your computer processes?
Leverage & Lean is here to help!

Powered By MemberPress WooCommerce Plus Integration

Free Macro

Start creating Less Clicks, More Results today!