Excel constantly plays a crucial position in automating the assignment with a Macro or BA code. In this article, we will discover ways to create a completely automated statistics collator tool in Excel and VBA. Please comply with the beneath steps.
Step 1
Create a New Excel File and save it with the name ‘Automated Data Collator’. Make sure the extension should be ‘.xlsm’ otherwise, the file will not retain the VBA codes.
Step 2
Add two different sheets in the ‘Automated Data Collator’ file. Rename the ‘Sheet1’ to ‘Home’ and ‘Sheet2’ to ‘Collated Data’.
Step 3
Create the label and add a command button (rounded rectangle) from the shape with ‘Collate’ caption. Please see the below image.
Step 4
Add the required column headers in the ‘Collated Data’ sheet in row 1. Please see the below image and use the same headers and formatting.
Step 5
Let’s move to the Visual Basic Application window. To jump to the VBA window, click on Developer Tab then click on VBA in code group. Alternatively, you can press shortcut key ALT + F11.
In this tool, we will utilize FileSystemObject(FSO) and it’s methods. So, let’s add the reference of FSO. To do that, click on Tools menu and then click on ‘Reference’ and select ‘Microsoft Scripting Runtime’ from the available references. Please see the below image.
Step 6
To write the codes, let’s insert a new Module in our project. To add a module, click on Insert menu then click on ‘Module’.
Step 7
Let’s add the below VBA codes in the Module1 code window.
Now, we have done with coding. Let’s move to Excel window and assign the macro on ‘Collate’ button available on ‘Home’ sheet.
Please click on the below button to download the Excel File (Data Collator) used in our tutorial.
No comments: