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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Eh, is that a capital M and F I see in the password?:)
 
Upvote 0
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.
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,214,771
Messages
6,121,453
Members
449,033
Latest member
Kcolwell16

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
Back
Top