View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Brenda Brenda is offline
external usenet poster
 
Posts: 137
Default suggestions for another code

Loyd, After running the program with the code you gave me i am now getting
another error message that states run time error 1004 (unable to set the
visible property of the worksheet class.

Here is the thing i have buttons on the other pages so that if someone were
to click on this button it will bring up the tab i have hidden and when they
click on another button it will hide the tab that they had clicked on before
and bring up the new tab. I think this is the reason why I am getting the
errors messages, I think we may be back to square one :-(
Here is the code for the buttons that worked great...
Sub UnHideHerdDescription()
Sheets("HerdDescription").Visible = True
Sheets("HerdDescription").Select
End Sub

Sub UnHideRequirements()
Sheets("Requirements").Visible = True
Sheets("Requirements").Select
End Sub

Sub UnHideIngredients()
Sheets("Ingredients").Visible = True
Sheets("Ingredients").Select
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As range)
End Sub

Sub UnHideMakeAMix()
Sheets("MakeAMix").Visible = True
Sheets("MakeAMix").Select
End Sub

Sub UnHideAutoBalance()
Sheets("AutoBalance").Visible = True
Sheets("AutoBalance").Select
End Sub

Sub UnHideEvaluate()
Sheets("Evaluate").Visible = True
Sheets("Evaluate").Select
End Sub

Sub UnHideReportAutoBalance()
Sheets("ReportAutoBalance").Visible = True
Sheets("ReportAutoBalance").Select
End Sub

Sub UnHideReportEvaluate()
Sheets("ReportsEvaluate").Visible = True
Sheets("ReportsEvaluate").Select
End Sub

The thing is when i first bring up the workbook it is hidding the tabs when
you open it but now i can't click on the buttons to take them to other tabs
that I hide. Can you help me out on this?
h
--
Thank you, Brenda


"Simon Lloyd" wrote:


This is possibly what you want, but without seeing a workbook its
difficult:

Private Sub Workbook_Open()
'check for solver
If (CheckSolver = False) Then
MsgBox "Solver Add-In is not installed, you will not be able to" &
vbNewLine & _
"solve least costing on the Auto-Balance sheet." & vbNewLine & _
"Consult Excel help forinformation on installing the Solver Add-In."
End If
'load the expiry date from cell Expiration!B1
Expiry = getExpirationDate
rightNow = Date
'if we have expired, or moved to a different machine
If (Expiry = Empty Or rightNow Expiry Or Not _
IsDataValid(getRegistrationNumber, getExpirationDate)) Then
showExpiryDialog
End If
Call Sheets_Hide
End Sub

Private Sub resetToStart()
setUseCount getUseCount + 1
If (getFirstUsed = Empty) Then
setFirstUsed Date
End If
Geminator.Protect "AmIn0"
End Sub

Private Sub showExpiryDialog()
registrationForm.regTextBox.SetFocus
registrationForm.regTextBox.SelStart = 0
registrationForm.regTextBox.SelLength = _
Len(registrationForm.regTextBox.Text)
registrationForm.Show
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call Sheets_Hide
resetToStart
Geminator.Save
End Sub

Private Sub Sheets_Hide()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Sheets
If ws.Name < "Instructions" Then
ws.Visible = xlSheetVeryHidden
End If
Next ws
Application.ScreenUpdating = True
End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'www.thecodecage.com' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=27108