No replies, so again : How to add Combobox to cell dynamically?

A

Abhinav

Hi,


1. I need to check the 1st column (A) of each row, and if it is not
empty, add a combobox to column B of that row.

Trivial .. I hope i will be able to do it, but seggestions welcome :
2. I need to be populate the combobox with data from some other sheets
in the same workbook
3. I need to be able to go to a specific web page if any combobox
entry is clicked. For eg : if entry 1234 is clicked, i should go to
http://www.example.com/1234

Any pointers , especially to (1) above, are appreciated.

Any good startup resources on the net (free, please) are also welcome


Thanks
Abhinav
 
S

SunTzuComm

I've had little luck creating design-time objects at run time. It's extremely
messy, when it's possible at all.

You might try creating a combo box for each row at design time, but set its
Visible property to False. Then at run time, you can set the Visible property
to True for each combo box as appropriate, and populate its contents. Still
very messy.

Hope this helps,
Wes
 
V

Vic Eldridge

Hi Abhinav,

Try running the InsertCombos macro I've made for you. As it creates
the comboboxes, it uses the contents of cells A1:A5 (on Sheet2) to
define the list for the comboboxes. If you needed a different list
for each Combobox, post back with more details. Make sure the
ShowWebPage macro is in a standard module, it will be run whenever
you make a selection from one of the ComboBoxes.

Regards,
Vic Eldridge


Sub InsertCombos()
Dim cel As Range
For Each cel In Range("A1", Range("A65536").End(xlUp))
If cel.Value <> "" Then
With ActiveSheet.DropDowns.Add( _
Left:=cel.Offset(0, 1).Left, _
Top:=cel.Top, _
Height:=cel.Height, _
Width:=80)
.ListFillRange = "Sheet2!$A$1:$A$5"
.OnAction = "ShowWebPage"
End With
End If
Next cel
End Sub

Sub ShowWebPage()
With ActiveSheet.DropDowns(Application.Caller)
ActiveWorkbook.FollowHyperlink Address:= _
"http://www.example.com/" & .List(.ListIndex)
End With
End Sub
 
Top