From the course: Excel VBA: Managing Files and Data
Create a multipage or multitab UserForm - Microsoft Excel Tutorial
From the course: Excel VBA: Managing Files and Data
Create a multipage or multitab UserForm
- [Narrator] The amount of space that users have on their screen, depends on the type of device they're using. In this movie, I will show you how to take advantage of what could be a limited space by creating MultiPage and MultiTab Userforms. My sample file's 0608 Tabs and Pages, and you can find it in the chapter six folder of the Exercise Files collection. I'm not going to be working in the body of the workbook at all. So I'll press ALT + F11 to move to the Visual Basic Editor. And here I have a Userform already set up. I want to add a MultiPage control first. So I'll go over to the toolbox, which is here. If you don't see the toolbox, for example, if it was hidden, you can go up to the menu bar and click the toolbox button to bring it back. So I'll go over and I will click the MultiPage icon and then I will drag it on the body of the Userform to define it. So you can see that I now have a MultiPage control with page one and page two. If you click a pages tab, then it's activated. So, page two is active right now and then page one. Each page is, essentially, a separate Userform so you can add controls, labels, and so on. Some things that are unique to pages are that you can move them, rename them, and do other things with them, as pages, as opposed to, basically, smaller Userforms. To get to those functions you right click a page tab. So in this case I'll right click page one. And you can add a new page, delete the current page, rename it, or move it. I'll click rename. And then in the rename dialogue box I will change the pages caption. That's the text that appears on the tab. So I'll type customer info and click okay. And you see that the first tab, or first page has been renamed. I can also change this position by moving it. So I will right click customer info, click move. Customer info is currently selected. I'll click move down to move it down below page two in this page order, but it'll actually move to the right when I click okay. And you can see that change has taken place in the Userform. That's all I'll do here for now. So I will click the MultiPage control and press delete. And now I can add a multi-TabStrip. So I'll go back to the toolbox, hover over the TabStrip, click it. And then I will drag on the Userform. And you can see that a TabStrip looks very much like a MultiPage form except that the backgrounds are already filled in. I don't have a strong preference for MultiPage versus TabStrip controls, but having the backgrounds already there is a small difference. So take that into mind when you are creating your own TabStrips and MultiPage controls. Let's say that I want to add a tab to the right of tab two. To add a tab, to the right of tab two, I will click tab two. I had to click it twice because I needed to activate the TabStrip itself. So right click there, and click new page, and the tab goes to the right. And you can see the options were exactly the same for the TabStrip as they were for the MultiPage control. If I want to delete a tab or a page, I can right click, click delete page, and it goes away. As you can see, tabs and MultiPage controls allow you to add controls to a Userform without taking up more space than you had originally planned.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Create a UserForm2m 38s
-
(Locked)
Add a TextBox to a UserForm3m 31s
-
(Locked)
Add a ListBox to a UserForm4m 52s
-
(Locked)
Add a ComboBox to a UserForm4m 55s
-
(Locked)
Add an option button to a UserForm3m 55s
-
(Locked)
Add graphics to a UserForm4m 28s
-
(Locked)
Add a SpinButton to a UserForm4m 16s
-
Create a multipage or multitab UserForm3m 50s
-
(Locked)
Write UserForm data to a worksheet7m 39s
-
(Locked)
Run a UserForm4m 8s
-
(Locked)
-
-