Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default opening a worksheet with a command button on a form

The following sub produces an error 9
any ideas..is it because it is in a seperate form?

Sub Button1_Click()
Worksheets("Sheet1").Activate
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default opening a worksheet with a command button on a form

hi,
error 9:script out of range.
you get this error when you tell xl to do something it can't. like select a
sheet name that doesn't exist or tell it to select a range that takes it off
the sheet.
in your case, i would suspect that it is because it is a button on a form
and the form is modal. I have done no testing but when a form is modal, the
user must respond before using any other part of the application. No
subsequent code is executed until the form is hidden or unloaded. to set as
modaless...

Yourform.show 0

if you omit the zero, the form will load as modal. modal = 1

if you can select the sheet by click it's tab then the form is modaless.
otherwise, it's modal.

hope this helped
Regards
FSt1


"gbpg" wrote:

The following sub produces an error 9
any ideas..is it because it is in a seperate form?

Sub Button1_Click()
Worksheets("Sheet1").Activate
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 58
Default opening a worksheet with a command button on a form

I am not sure what you said. Where would Yourform.show 0 be seen and where
would modal=1 be set?

"FSt1" wrote:

hi,
error 9:script out of range.
you get this error when you tell xl to do something it can't. like select a
sheet name that doesn't exist or tell it to select a range that takes it off
the sheet.
in your case, i would suspect that it is because it is a button on a form
and the form is modal. I have done no testing but when a form is modal, the
user must respond before using any other part of the application. No
subsequent code is executed until the form is hidden or unloaded. to set as
modaless...

Yourform.show 0

if you omit the zero, the form will load as modal. modal = 1

if you can select the sheet by click it's tab then the form is modaless.
otherwise, it's modal.

hope this helped
Regards
FSt1


"gbpg" wrote:

The following sub produces an error 9
any ideas..is it because it is in a seperate form?

Sub Button1_Click()
Worksheets("Sheet1").Activate
End Sub

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
Creating a Command Button on a worksheet GeorgeJ Excel Discussion (Misc queries) 0 August 1st 07 09:42 PM
User form and Command button Marilyn Excel Discussion (Misc queries) 3 May 9th 07 12:50 AM
Command Button on User form for Printing Anthony Slater Excel Discussion (Misc queries) 2 September 7th 05 02:01 PM
How do I add a command button on a worksheet to "paste" from the . [email protected] Excel Worksheet Functions 3 March 13th 05 06:25 PM
Command button on data-entry form Susy Excel Discussion (Misc queries) 1 February 15th 05 01:46 AM


All times are GMT +1. The time now is 07:27 AM.

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

About Us

"It's about Microsoft Excel"