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
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
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,218
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:

Watch MrExcel Video

Forum statistics

Threads
1,122,485
Messages
5,596,442
Members
414,065
Latest member
kamlkham

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