ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Guided Button??? (https://www.excelbanter.com/excel-programming/345121-user-guided-button.html)

locutus243

User Guided Button???
 

Hi guys,

I have 100 worksheets all with different names and a main menu. Fro
the main menu I want to be able to press a button that opens an inpu
box in which I can type the name of the worksheet I want to go to an
then a macro will take me to that worksheet.

I've been experimenting and have the following code in VB. It brings u
an input box but then whenever I enter anything and click OK, an erro
message appears. Could anyone give me a hand???

Thanks

Mark

Heres my code:-

Sub RoundToZero()
Worksheets("Main Page").Activate
On Error GoTo PressedCancel
Set Pub = Application.inputbox( _
prompt:="Enter your EKR Pubn Code", _
Type:=0)
Worksheets("Pub").Activate

Exit Sub

PressedCancel:
Resume
End Su

--
locutus24
-----------------------------------------------------------------------
locutus243's Profile: http://www.excelforum.com/member.php...fo&userid=1286
View this thread: http://www.excelforum.com/showthread.php?threadid=48342


Herbert

User Guided Button???
 
Hello"

The statement
Worksheets("Pub").Activate
tries to activate a worksheet called "Pub", which most likely doesn't exist

Just omit the quotation marks:
Worksheets(Pub).Activate

Herbert

"locutus243" wrote:


Hi guys,

I have 100 worksheets all with different names and a main menu. From
the main menu I want to be able to press a button that opens an input
box in which I can type the name of the worksheet I want to go to and
then a macro will take me to that worksheet.

I've been experimenting and have the following code in VB. It brings up
an input box but then whenever I enter anything and click OK, an error
message appears. Could anyone give me a hand???

Thanks

Mark

Heres my code:-

Sub RoundToZero()
Worksheets("Main Page").Activate
On Error GoTo PressedCancel
Set Pub = Application.inputbox( _
prompt:="Enter your EKR Pubn Code", _
Type:=0)
Worksheets("Pub").Activate

Exit Sub

PressedCancel:
Resume
End Sub


--
locutus243
------------------------------------------------------------------------
locutus243's Profile: http://www.excelforum.com/member.php...o&userid=12862
View this thread: http://www.excelforum.com/showthread...hreadid=483423



locutus243[_2_]

User Guided Button???
 

Hey,

Thanks for taking a stab at trying to help me, I really appreciate it


I took out the quotation marks but when I enter my worksheet name i
the inputbox it still throws an error message at me.

I have 100 worksheets each title is a 2 or three digit number (i.e
351, 54). I want to be able to type my number in and then it'll go t
that worksheet. I don't understand why its not working, the code seem
alright to me (until the error msg appears). But I have very littl
knowledge of VB..

Thanks

Mar

--
locutus24
-----------------------------------------------------------------------
locutus243's Profile: http://www.excelforum.com/member.php...fo&userid=1286
View this thread: http://www.excelforum.com/showthread.php?threadid=48342


Bob Phillips[_6_]

User Guided Button???
 
See response in excel.misc

--

HTH

RP
(remove nothere from the email address if mailing direct)


"locutus243" wrote
in message ...

Hey,

Thanks for taking a stab at trying to help me, I really appreciate it.


I took out the quotation marks but when I enter my worksheet name in
the inputbox it still throws an error message at me.

I have 100 worksheets each title is a 2 or three digit number (i.e.
351, 54). I want to be able to type my number in and then it'll go to
that worksheet. I don't understand why its not working, the code seems
alright to me (until the error msg appears). But I have very little
knowledge of VB..

Thanks

Mark


--
locutus243
------------------------------------------------------------------------
locutus243's Profile:

http://www.excelforum.com/member.php...o&userid=12862
View this thread: http://www.excelforum.com/showthread...hreadid=483423





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com