PC Review


Reply
Thread Tools Rate Thread

Display worksheet with prompt/button

 
 
alanad
Guest
Posts: n/a
 
      8th Sep 2004
I was wondering if there is a way to have Excel prompt the user with
question, then open up a worksheet based on the answer to tha
question?

For example, when Excel opens it could ask the user to make th
appropriate choice about what part of the workbook they want to use
then open up the corresponding worksheet....ie. if the user wants th
"apples" worksheet they could select the apples button and if they wan
the "oranges" worksheet they could select the oranges button and woul
be taken to the appropriate worksheet based on the button they select

--
Message posted from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      8th Sep 2004
Create a userform (named, say, ChooseForm) with a command button for
each sheet. Then put this code in the ThisWorkbook code module:


Private Sub Workbook_Open()
Dim cf As ChooseForm
Set cf = New ChooseForm
cf.Show
Set cf = Nothing
End Sub

and put this in the userform's code module:

Private Sub CommandButton1_Click()
ThisWorkbook.Sheets("Apples").Select
Unload Me
End Sub


Private Sub CommandButton2_Click()
ThisWorkbook.Sheets("Oranges").Select
Unload Me
End Sub



In article <(E-Mail Removed)>,
alanad <<(E-Mail Removed)>> wrote:

> I was wondering if there is a way to have Excel prompt the user with a
> question, then open up a worksheet based on the answer to that
> question?
>
> For example, when Excel opens it could ask the user to make the
> appropriate choice about what part of the workbook they want to use,
> then open up the corresponding worksheet....ie. if the user wants the
> "apples" worksheet they could select the apples button and if they want
> the "oranges" worksheet they could select the oranges button and would
> be taken to the appropriate worksheet based on the button they select.

 
Reply With Quote
 
JulieD
Guest
Posts: n/a
 
      8th Sep 2004
Hi

yes - one way, copy and paste the following code into a module sheet in the
workbook of interest (right mouse click on a sheet tab, choose view code,
choose Insert / Module ... paste the following from SUB to END SUB on the
right hand side of the screen) ... adjust the question as appropriate.

Then to link it to a button, create a button (if you use the command button
control off the Forms toolbar the macro dialog box will open up
automatically - choose selectsheet and click OK.


sub selectsheet()
dim gotosheet as string
Do
gotosheet = Inputbox("What is your favourite fruit?","Choose
Fruit","Apples")
Loop Until gotosheet<>""
ActiveWorkbook.Sheets(gotosheet).activate
End Sub

let us know how you go
Cheers
JulieD



"alanad >" <<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I was wondering if there is a way to have Excel prompt the user with a
> question, then open up a worksheet based on the answer to that
> question?
>
> For example, when Excel opens it could ask the user to make the
> appropriate choice about what part of the workbook they want to use,
> then open up the corresponding worksheet....ie. if the user wants the
> "apples" worksheet they could select the apples button and if they want
> the "oranges" worksheet they could select the oranges button and would
> be taken to the appropriate worksheet based on the button they select.
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
prompt to save on exit - disable prompt on save button Mel Microsoft ASP .NET 10 13th Feb 2009 05:32 AM
Scan data on worksheet 2 and display a summary on Worksheet 1 =?Utf-8?B?U29ueQ==?= Microsoft Excel Programming 0 29th Jan 2007 08:27 PM
Change Worksheet Button Caption on Worksheet.Activate =?Utf-8?B?TWlrZVp6?= Microsoft Excel Programming 1 7th Dec 2006 06:01 AM
print different worksheet by pressing visible button on worksheet =?Utf-8?B?Q29uZnVzZWQ=?= Microsoft Excel Worksheet Functions 2 13th Jun 2005 02:22 PM
A cell copied onto one worksheet from another worksheet does display same formatting. =?Utf-8?B?TWFyaw==?= Microsoft Excel Misc 3 5th Jan 2004 04:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:17 AM.