MrExcel Publishing
Your One Stop for Excel Tips & Solutions

THIS ONE IS TRICKY : How to set focus and disabling multipages or tabs in VBA

Posted by Darren on July 11, 2000 3:39 AM

Hi everybody!!!

I got a tricky questions for you guys. How do you guys, based on a value selected by user(e.g. using dropdown), set focus to a particular page in multipage or tabs (let's say "Page 1") while disabling other pages so that user won't able to access functions in other page except for "Page 1".

Anyone got the coding in VBA???

Posted by Ivan Moala on July 12, 0100 1:20 AM

Just to add a little to Ryans
Use his suggestion in the listbox change event eg
Private Sub ListBox1_Change()

Select Case ListBox1.ListIndex

Case 0
MultiPage1.Value = 0
Case 1
MultiPage1.Value = 1
Case 2
MultiPage1.Value = 2
Case 3
MultiPage1.Value = 3
End Select

End Sub


Posted by Ryan on July 11, 0100 4:56 AM

To change to whatever Tab you want you use:
If Listbox1.Value = "" Then
MultiPage1.Value = 0 (for page 1) and so on
End if
Or it might be better to do a select case in this case.
To disable the other pages you use:

MultiPage1.Pages(x).Enabled = False where x is equal to the page number.

Now you just need the logic for the dropdown list with this code. Hope this helps. Let me know if there is anything else.