Navigate Userforms

mnordeen

Board Regular
Joined
Mar 27, 2006
Messages
165
So I have a workbook with quite a few UserForms, as you go through the tool the choice of what form to go to next will change. So I would like them to be able to back out in the same order they went in. FYI there are 25 different forms and how they go through will be different. My thought to fix this is to use several cells as place holders to keep track of how they do this and use a Select to help figure out where they are and how many deep they have gone. (I hope that makes sense) here are the two vba I used one that is used every time they go one more deep in and one for when they are backing out. I am getting a no object found error on the backing out part, I feel like I am missing something small. Can you help, please?

VBA Code:
Private Sub CButtonEquipment_Click() ' Going in
Select Case Sheets("ActiveDataCab").Cells(12, 4)
 Case 0
  Sheets("ActiveDataCab").Cells(13, 4).Value = Me.Name
 Case 1
  Sheets("ActiveDataCab").Cells(14, 4).Value = Me.Name
 Case 2
  Sheets("ActiveDataCab").Cells(15, 4).Value = Me.Name
 Case 3 Or higher
  Sheets("ActiveDataCab").Cells(16, 4).Value = Me.Name
 End Select
Unload Me
 UFv5Equipment1.Show
End Sub


VBA Code:
Private Sub CBExit3_Click() 'Backing out
Dim UF1 As Object
 Select Case Sheets("ActiveDataCab").Cells(12, 4)
 Case 0
  Unload Me
  UFv5Main1.Show
 Case 1
  Set UF1 = Sheets("ActiveDataCab").Cells(13, 4).Value
  Unload Me
  UF1.Show
  Sheets("ActiveDataCab").Cells(13, 4).ClearContents
 Case 2
  Set UF1 = Sheets("ActiveDataCab").Cells(14, 4).Value
  Unload Me
  UF1.Show
  Sheets("ActiveDataCab").Cells(14, 4).ClearContents
 Case 3
  Set UF1 = Sheets("ActiveDataCab").Cells(15, 4).Value
  Unload Me
  UF1.Show
  Sheets("ActiveDataCab").Cells(15, 4).ClearContents
 Case Is >= 4
  Set UF1 = Sheets("ActiveDataCab").Cells(16, 4).Value
  Unload Me
  UF1.Show
  Sheets("ActiveDataCab").Cells(16, 4).ClearContents
 End Select
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Have you heard of a Userform Multipage?
With a Multipage you can have numerous looking like user forms on one Userform.
 
Upvote 0
Are you talking about the multi page this with tabs? I have, there is too many and the users of this have trouble with that.
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,150
Members
452,615
Latest member
bogeys2birdies

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