UserForm – MultiPage control in (ActiveX controls)

Last Updated on January 11, 2023 by token

Insert Multi Page tabs into the UserForm

VBA MultiPage Contol are pages of your application, between which the user will be able to jump. On each page you will see other elements and content of the application. To insert pages into our UserForm, you should choose the MultiPage control from the ToolBox

Insert MultiPage tabs into the UserForm

In this example your application should have two pages: start and about. By right-clicking on it, you can add another page by selecting “New Page”. Then click Rename and change names for our pages. When changing the names, you can also insert a shortcut key of the page and content that will display to us in the window of hints when the cursor is over the tab.

VBA Multipage – pages rename and tips

VBA Multi Page – Programming

If you want to program some features on VBA MultiPage pages, just drag them from ToolBox Window and drop on pages. In this case firstly create two pages and edit them names to Start and About. You can also edit your UserForm name. Simply go to UserForm Properties window and edit caption field to My App.

  • Click on About page
  • Drag and drop Frame ActiveX control into your form
  • Go to properties of Frame and edit it Caption field to About App
  • Next drag and drop label and type some text ie. This is my best application written in VBA
  • Type F5 button to test it
VBA Excel application programming VBA Frame
  • Click on Start page
  • From ToolBox drag and drop one Command Button (Check in properties its name ie. CommandButton1)
  • Change Caption field value in Command Button’s properties to Insert
  • From ToolBox drag and drop two text boxes (Check in properties its names ie. TextBox1 and TextBox2)
  • From ToolBox drag and drop two labes and edit Caption fields (ie. First Name, Last Name)
  • Check name of your firs blank SpreedSheet (ie. Sheet1). Name will be used in VBA code
  • Click twice on your Command Button and type VBA code:
Private Sub CommandButton1_Click()
   Sheet1.Cells(1, 1) = TextBox1
   Sheet1.Cells(1, 2) = TextBox2
End Sub

Now you can test your app

VBA Multipage application. Insert data in rows

If You want to write VBA application, which will be inser names line by line, use this code:

Private Sub CommandButton1_Click()
   'Last filled row + 1
   intRow = Application.WorksheetFunction.CountA(Range("A:A")) + 1

   Sheet1.Cells(intRow, 1) = TextBox1
   Sheet1.Cells(intRow, 2) = TextBox2
End Sub
VBA MultiPage – insert into last unfilled row

VBA Multi Page – Properties

In MultiPage properties you can edit some of

All of pages from VBA multi page window have their own properties options. In example listed above, we have two pages – Start and About. We can edit also two different properties for them. In MultiPage Properties window you can edit in example:

  • (name) – name using in programming Multi Page
  • Caption – Text written on the page button
  • Picture – You can add a picture into a page. Just choose an image
VBA Multi Page – Properties options

File with examples:

More examples of Excel VBA basics can be found in the Excel VBA Tutorial section and  VBA Examples section.

Leave a comment

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

%d bloggers like this: