Code Refuses To Work . .

Evagrius Ponticus

Well-known Member
Joined
May 24, 2007
Messages
1,467
I don't udnerstand why this doesn't work - it's making want to take a hammer to my monitor :) It freaks out in the .controls.add line . .

Code:
Private Sub UserForm_activate()
If LCase(InputBox("Password")) = "MadFrog" Then
    Dim i As Integer
    For i = 1 To Sheets.Count
    Me.MultiPage1.Pages.Add , Sheets(i).Name
    Me.MultiPage1.Pages(i).Controls.Add "Forms.checkbox.1"
    Next i
    
    Else
    
    Unload Me
    End If
    
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,344
Office Version
  1. 365
Platform
  1. Windows
Eh, is that a capital M and F I see in the password?:)
 

Evagrius Ponticus

Well-known Member
Joined
May 24, 2007
Messages
1,467
Hmmm, turns out that the index for the first page in the Multipage is 0. But in an Excel workbook the first sheet has an index of 1. That's just confusing.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,344
Office Version
  1. 365
Platform
  1. Windows
Slightly confusing, yes.:eek:

But they are completely different objects after all.:)

And I think you'll find a few other things that are zero based.
 
Last edited:
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,186
Messages
5,835,886
Members
430,392
Latest member
bongouni553

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top