LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Hyperlinks in drop-down list

cdb wrote in message ...
Hi,

I'm trying to create a table of contents using a drop down list showing
the various worksheets I have in a workbook, and when you click on one
of the worksheet titles it takes you there. Hyperlinks are easy, drop
down lists are easy, now how do I mix the 2 together? :)

(I realize when you right-click on the VCR controls Excel does this for
you, but most of the people who will use this document don't know that.
It's more for useability and cleanliness).


There's no need to use hyperlinks. You just need to trap the ComboBox
change event and activate the selected worksheet. (BTW, what do you
mean by VCR controls?)

I've implemented your question using a VBA userform and module macro.

First, in the VBA IDE, create a UserForm (UserForm1) containing a
ComboBox (ComboBox1) and a CommandButton. The command button is just
for closing the form.

Add the following code to UserForm1:

Private Sub ComboBox1_Change()
Worksheets(ComboBox1.List(ComboBox1.ListIndex)).Ac tivate
End Sub

Private Sub CommandButton1_Click()
Unload UserForm1
End Sub

------

Next, add a Module and define the following macro:

Sub SelectSheet()
'Populate the Combobox with the worksheets in this workbook

Dim i As Integer

For i = 1 To Worksheets.Count
UserForm1.ComboBox1.AddItem Worksheets(i).Name
Next

UserForm1.ComboBox1.ListIndex = 0
UserForm1.Show

End Sub

----------

Run the SelectSheet macro to display the form, and select any sheet in
the workbook from the combobox. Click the command button or X close
icon to close the form.

I hope that helps.
 
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
Drop Down List with Macro/Hyperlinks cncf Excel Discussion (Misc queries) 4 June 15th 08 02:44 AM
Hyperlinks in drop down list Jan Excel Discussion (Misc queries) 3 December 18th 06 03:07 PM
excel drop down list of hyperlinks Keith Excel Worksheet Functions 7 November 8th 06 08:13 PM
Multiple hyperlinks from drop down list lauren_roberts08 Excel Discussion (Misc queries) 0 June 13th 06 03:19 PM
Drop down list with hyperlinks... jtho13 Excel Discussion (Misc queries) 1 January 29th 06 07:20 AM


All times are GMT +1. The time now is 06:16 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"