Calling Programs in other sheets

W

wilro85

I'm building a workbook that uses checkboxes to turn pages on or off
(via hiding them). What I want to do is hide the coresponding summary
in the economic overview page when a particular feature is disabled.
However, for whatever reason, I am unable to write a successful program
to do this.

My first instinct was to try something like this:

Private Sub CheckBox1_Click()
Application.ScreenUpdating = False
Call Sheets("overview").special
If CheckBox1 = True Then
Range("a18").Select
Selection.EntireRow.Hidden = False
CommandButton7.Visible = True
SHEETS(\"OVERVIEW\").SELECT
RANGE(\"A66\").SELECT
SELECTION.ENTIREROW.HIDDEN = FALSE
SHEETS(\"SUMMARY\").SELECT
Else
If Worksheets("overview").Range("b58").Value = 0 And
Worksheets("overview").Range("c58").Value = 0 Then
Range("a18").Select
Selection.EntireRow.Hidden = True
CommandButton7.Visible = False
SHEETS(\"OVERVIEW\").SELECT
RANGE(\"A66\").SELECT
SELECTION.ENTIREROW.HIDDEN = FALSE
SHEETS(\"SUMMARY\").SELECT
Else
Application.ScreenUpdating = True
MsgBox ("The object you have choosen to hide contains values and thus
can't be hidden.")
End If
End If
End Sub

That would generate an error during the page switching part of the
code. I figured, alright, whatever you stupid program, I'll just work
around you. So I wrote a seperate program on the other sheet, and
inserted a call program into the code, but that is also generating an
error. Thing about it is though, is I know this can be done because I
can make a program that sends numbers to a range on the other sheet, I
just can't get it to use a true/false value to exicute the program.
Any advice?

Call Sheets("Overview").special(1) -> or .special(0)

Sub special(tf)
If tf = 1 Then
Range("a66").Select
Selection.EntireRow.Hidden = False
Else
Range("a66").Select
Selection.EntireRow.Hidden = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top