View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Combo Box/Drop down box

I think using data|validation is the easiest way to implement this kind of
dropdown.

Debra Dalgleish has some very nice instructions he
http://contextures.com/xlDataVal01.html

Then I would add a button from the Forms toolbar that would have a macro
assigned to it.

Option Explicit
Sub testme()

Dim myCell As Range

Set myCell = ActiveSheet.Range("A1") '<-- change the address here.

If IsEmpty(myCell.Value) Then
Beep
Exit Sub 'nothing in the cell
End If

ThisWorkbook.FollowHyperlink myCell.Value
'or maybe...
'ThisWorkbook.FollowHyperlink "Http:\\" & myCell.Value

End Sub

If you decide to use a dropdown from the Forms toolbar or a combobox from the
control toolbox toolbar, you could have code that does the same kind of thing.




Yog wrote:

I know i'm being really dumb here, but i need someone to point out the
obvious to me!!

I am trying to use a combo box where the user selects an option from the box
and is taken to a webpage/document depending on the selection made. The data
range is not very big at all and at the moment is in a column on the very
same sheet, i.e. A12:A23.

I have tried the combo box from the forms toolbar and am fine with the data
range but am having problems when it comes to the VBA. Especially when i am
trying to determine the selection that has been made. I am unable to find the
variable that refers to 'what option has been selected'. I have also tried
using the cell link property but VB does not seem to like #if
Range("b12").value, stating that 'variable not defined'

I then tried the combo box from the control toolbox, but the problem i am
having there is specifying the data range which the combo box refers to.

I am presuming that after this it will be a matter of using the VBA 'Select'
command.

Thanks in advance


--

Dave Peterson