LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default VBA rookie question - listbox and GOTO

Hi Brad

Private Sub CommandButton1_Click()
On Error Resume Next
Worksheets(ListBox1.Text).Activate
Unload Me
End Sub

The On Error thing takes care of both "no such sheet" and "no listitem selected". Not in a
very elegang way, but it works most of the time.

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"Brad Zenner" wrote in message
...
I am creating a userform with a listbox of sheet names (e.g. APPLE, BANANA,
PEAR, etc.) All of the items in the list box reference sheet names in the
workbook.

What I'm wondering is if there is a way to go to the sheet that's selected
in the listbox when closing out of the userform (so when I select APPLE and
click OK, it takes me to the APPLE worksheet).

Any help is greatly appreciated. Thanks.
Brad Z




 
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
rookie question Nevermind Charts and Charting in Excel 2 June 12th 07 05:57 PM
goto (F5) question dford Excel Discussion (Misc queries) 2 January 13th 07 04:54 AM
Listbox Question Greg B Excel Discussion (Misc queries) 1 March 9th 05 02:17 PM
Validation Data & Goto question ma Excel Discussion (Misc queries) 2 March 1st 05 08:54 PM
Listbox question Stuart[_5_] Excel Programming 1 August 21st 03 07:16 PM


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

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"