I have a multipage userform control with two pages and button controls for cancel, back, next and finish.
When I set the multipage.value
attribute in the "back" button sub by subtracting 1, Excel freezes/hangs.
Private Sub btn_Back_Click()
' Set the buttons
Me.btn_Next.Enabled = True
Me.btn_Finish.Enabled = False
Me.btn_Back.Enabled = False
Me.multipage_add_xfr.value = Me.multipage_add_xfr.value - 1
End Sub
The code to "advance" to the second page by adding 1 works fine in the btn_Next_Click()
sub:
Me.multipage_add_xfr.value = Me.multipage_add_xfr.value + 1
Lastly, on UserForm_Initialize()
, setting the multipage control to the first page (e.g. value = 0) also crashes Excel.
Me.multipage_add_xfr.value = 0
UPADTE The following code works in a new userform that was created within the current project, but the old userform does not.
Private Sub CommandButton1_Click()
Me.CommandButton1.Enabled = False
Me.CommandButton2.Enabled = True
Me.MultiPage1.value = Me.MultiPage1.value + 1
End Sub
Private Sub CommandButton2_Click()
Me.CommandButton2.Enabled = False
Me.CommandButton1.Enabled = True
Me.MultiPage1.value = Me.MultiPage1.value - 1
End Sub
Private Sub UserForm_Initialize()
Me.CommandButton2.Enabled = False
Me.CommandButton1.Enabled = True
Me.MultiPage1.value = 0
End Sub
Thoughts?