Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stumped - What am I doing wrong?


On a workbook I'm making, I'm trying to have a customizable interface
that will hide items as the user desires, however, I get an error
calling the program I want to run across sheets. Thing that bothers me
about this is I know both programs work if I run them independently. I
also know that programs can run across sheets. Where am I going wrong?

Private Sub CheckBox1_Click()
Application.ScreenUpdating = False
If CheckBox1 = True Then
Range("a18").Select
Selection.EntireRow.Hidden = False
CommandButton7.Visible = True
CALL SHEETS(\"OVERVIEW\").SPECIAL
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
CALL SHEETS(\"OVERVIEW\").SPECIAL
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

*Other sheet*

Public Sub special()
If Sheets("summary").CheckBox1 = True Then
Range("a61").Select
Selection.EntireRow.Hidden = False
Else
Range("a61").Select
Selection.EntireRow.Hidden = True
End If
End Sub

*Edit - More info*

The specific error I get when I try to run the program is:

Runtime Error "1004"
Select method or Range class failed.

What does that mean?


--
wilro85
------------------------------------------------------------------------
wilro85's Profile: http://www.excelforum.com/member.php...o&userid=26935
View this thread: http://www.excelforum.com/showthread...hreadid=444530

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stumped - What am I doing wrong?


You don't need to call a seperate procedure to do this. You could simpl
use:

Private Sub CheckBox1_Click()
Application.ScreenUpdating = False
If CheckBox1 = True Then
Rows(18).Hidden = False
CommandButton7.Visible = True
Sheets("Overview").Rows(61).Hidden = False
Else
If Worksheets("overview").Range("b58").Value = 0 An
Worksheets("overview").Range("c58").Value = 0 Then
Rows(18).Hidden = True
CommandButton7.Visible = False
Sheets("Overview").Rows(61).Hidden = True
Else
Application.ScreenUpdating = True
MsgBox ("The object you have choosen to hide contains values and thu
can't be hidden.")
End If
End If
End Sub

Otherwise if you really want to have the seperate procedure, as it i
not worksheet event code it should be stored in a Module and not
worksheet code sheet. Add a module and change the macro to:

Public Sub special()
With Sheets("overview")
If Sheets("summary").CheckBox1 = True Then
.Range("a61").EntireRow.Hidden = False
Else
.Range("a61").EntireRow.Hidden = True
End If
End With
End Sub

Then in your Checkbox Click event you can reference it as:
Call Special

Hope this helps.
Rowa

--
Rowa
-----------------------------------------------------------------------
Rowan's Profile: http://www.excelforum.com/member.php...fo&userid=2653
View this thread: http://www.excelforum.com/showthread.php?threadid=44453

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stumped - What am I doing wrong?


Worked great. Thanks for the help

--
wilro8
-----------------------------------------------------------------------
wilro85's Profile: http://www.excelforum.com/member.php...fo&userid=2693
View this thread: http://www.excelforum.com/showthread.php?threadid=44453

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Still stumped LarryK Excel Worksheet Functions 7 March 30th 09 11:15 AM
stumped LarryK Excel Worksheet Functions 4 March 28th 09 05:54 PM
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
Stumped by IF Riskybizniz Excel Worksheet Functions 5 December 3rd 04 10:19 AM
Stumped Again John Petty Excel Programming 0 October 6th 03 02:34 PM


All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"