Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel form navigation in macro

Status
Not open for further replies.

hunt84

Technical User
Sep 26, 2001
2
US
Hi,

I'm using MS Excel 2000 and am stuck with a marco. I'm in the VB Editor and have two froms. One is a menu, the other is a form that i want to get to from the menu. I have command buttons on the forms and want these to be the means to get the user to go from one to the other and back. I have tried:

menu.Show

in the code and this works once but then when you try to go back to the origina menu there is an error because it is already open.

Any ideas?

Thank you
 
Hunt84,
You can refer the other form via a code of a modul.
insert a module and insert code like this:
Public Function u2()
On Error Resume Next
Load UserForm2
UserForm2.Show
End Function
Public Function u1()
On Error Resume Next
Load UserForm1
UserForm1.Show
End Function

and the c. button code of the form1:

Private Sub CommandButton1_Click()
Me.Hide 'hide the active form
u2
End Sub

c. button of the form2:
Private Sub CommandButton1_Click()
Me.Hide
u1
End Sub


i hope it helps You
ide
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top