I have the following problem: I have a userform menu, from there I can navigate to other pages, and I want to create a "back button" for each page to return to the menu.
I tried to create this:
Private Sub btnback_Click()
Call back_menu(Actions)
End Sub
Sub back_menu(stage) 'Tried: stage As Object
Unload stage
Menu.Show
End Sub
Another example:
Sub next_page(from,to)
Unload from
to.show
This 1st is working now, but everytime I close the userform i got an error:
Run-type error'13' Type missmatch
I know I could write one by one or I could us the Unload Me, but I have other Functions where I would like to use this method to call the right userform.
Thanks in advance
CodePudding user response:
Try using the hide
method of the userform
Sub back_menu(stage as UserForm) 'Tried: stage As Object
stage.hide
Menu.Show
End Sub
Sub next_page(frmFrom as UserForm, frmTo as UserForm)
frmFrom.hide
frmTo.show
end Sub
You shoud avoid variable names that are code words as well --> like to
in For i = 1 to 10
.