How to Close Excel Form in VBA

Published: 26 April 2013
on channel: Excel, Word and PowerPoint Tutorials from Howtech
28,503
42

In this tutorial we will work on excel forms and VBA and we will learn how to use excel vba to close form.

Microsoft Excel is not only a spreadsheet application, it has far more functionality. One of those is the ability to work with Visual Basic to create interactivity.

Follow this step by step east tutorial to learn how to close Excel form in VBA by using unloadme function.

Step # 1 -- Button setup

This is a particularly easy task as it involves writing a small statement. But before that, we must have a button created on that form.

For inserting a button, we have to go to "Insert" Menu and click "User Form".

After that we can Use the toolbox to drag and drop a button.

Let's name the button as "Save and close".

Step # 2 -- Unloading myself

Once the prerequisite is complete we will now tell the form to close on the press of the button. To do this we will double click on the button. This opens a new window with a sub routine already created for the button click event. Here we will write a small statement, the Unload Me command.

Since the form is supposed to close itself, it will use the Me keyword present in Visual Basic, otherwise the name of the form would have been written in its place.

And this was all about how we can use excel vba to close form.


Watch video How to Close Excel Form in VBA online, duration hours minute second in high quality that is uploaded to the channel Excel, Word and PowerPoint Tutorials from Howtech 26 April 2013. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 28,503 times and liked it 42 visitors.