I have a Multi-Page UserForm in Excel 2010. I want there to be a field for the user to specifiy how many additional pages they need to add to the form (each additional page will reference a number of people).

The UserForm currently has three pages and the user will only need to duplicate page 3. I found the following information online,

Dynamically Add/Remove a Page:

Using the Add Method: Syntax: Set m = MultiPage1.Pages.Add(pageName, pageCaption, pageIndex). pageIndex (optional) is an integer which specifies the position for the Page to be inserted, starting from 0 for the first position/Page. pageName sets the Name for the Page, pageCaption sets the Caption. Both are optional to specify.

Set m = MultiPage1.Pages.Add("Page5", "NewPage", 1) - this code adds a new Page with name Page5 and Caption NewPage, as the second Page (viz. second position in the page order).

MultiPage1.Pages.Add "Page3"; MultiPage1.Pages(2).Caption = "NewPage" - these 2 codes add a new (third) Page with name Page3 and set its Caption to NewPage.

MultiPage1.Pages.Add - this code simply adds a new Page.

To Remove a Page - Syntax: MultiPage1.Pages.Remove (pageIndex). Example: MultiPage1.Pages.Remove (1) - this code removes the second Page.

So, to test this I created a button and below is what I put into my code, but this hasn't been working. I've been getting a Compile Error: Method or data member not found. The name of my worksheet is 'IntvwWorksheet' and the name of page 3 is 'Candidate1'.

Private Sub AddCand_CommandButton_Click()
    Set M = IntvwWorksheet.Pages.Add("Candidate2", "Candidate 2", 4)
    
End Sub
Can someone help me with this. Since I want the user to be able to say they want to add, for example, 5 more duplications of page 3, or 10 more duplications of page 3, it would be helfpul to know how to specify this as it may not always be Candidate2 or page insertion at 4.

Currently, I have this as a button, but again, I would like a field where the user can simply specify how many they want added.

Thank you for your help.