PDA

View Full Version : random problem



rodney_malod
03-19-2007, 04:09 PM
using Excel and VBA i have been designing a stress analysis tool for my company. i am now required to make this tool which consists of 5 pages to operate over one window. i need code to show a page or window in which numbers can be inputted and then calculations done.

i can't think of a way with userforms so i pressume i will have ot just use code to hide excel sheets?

:help i'm stumped on this!!!

mdmackillop
03-19-2007, 04:40 PM
Hi Rodney,
There's a KB item here (http://vbaexpress.com/kb/getarticle.php?kb_id=16) which creates an index of worksheets. The following ThisWorkBook module code will show/hide sheets when accessed using the hyperlinks
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If Sh.Name <> "Sheet1" Then
Sh.Visible = False
End If
End Sub

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
If Sh.Name <> "Sheet1" Then Exit Sub
Sheets(Target.TextToDisplay).Visible = True
Sheets(Target.TextToDisplay).Activate
End Sub