UserForm – Building an application in Excel VBA

Last Updated on January 11, 2023 by token

How to build an application in Excel VBA using the UserForm form

In the last part of the course we will deal with the creation of a short application using the form. As in the case of the previous application, we should write down the basic requirements based on which our application will operate::

  • Our goal is to build a simple application for converting net prices into gross and vice versa.
  • The application should have 3 MultiPage tabs with the names Netto on Gross, Gross on Net, About the Program
  • The ComboBox Combo box should be used to choose the VAT rate . You can choose from 5%, 8%, 23%
  • The application should display both the initial price and the result in the TextBox fields
  • The conversion should take place after pressing the CommandButton “Recalculate” button
  • The form should run when opening an Excel file
  • In the “About program” tab, a short description of the application should be inserted

Start writing the program using the UserForm form

At the very beginning, create an Excel file named  Forumularz_userform_kalkulator_brutto_netto.xlsm . The whole should be saved as an Excel workbook with macro support, ie an extension of .xlsm. Enter the VisualBasic Editor , select the UserForm form from the insert tab. In our Project window should appear a new object named UserForm1. We would like our form to run when opening an Excel file. From the objects in the Project window, select the code of the Ten_skortoszyt object . We enter the following code:

Private Sub Workbook_Open()
UserForm1.Show
End Sub

To check the operation of our form every time after making changes in it, we should enter the UserForm1 object, and then press the F5 key . At the end, we enter the properties of our form. We edit the Caption field by entering the phrase ” VAT Application “.

Leave a comment

Your email address will not be published. Required fields are marked *

One thought on “UserForm – Building an application in Excel VBA”

%d bloggers like this: