ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting a combobox (https://www.excelbanter.com/excel-programming/287852-inserting-combobox.html)

Stefan[_6_]

Inserting a combobox
 
How do I insert a combobox programmatically into a
specific cell, say B4, that exactly fits the size of the
cell?

Stefan

patrick molloy

Inserting a combobox
 
Option Explicit
Sub TestAdd()
AddCombo Range("K5")
End Sub

Sub AddCombo(rTarget As Range)
With rTarget
ActiveSheet.OLEObjects.Add
(ClassType:="Forms.ComboBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=.Left, _
Top:=.Top, _
Width:=.Width, _
Height:=.Height).Select
rTarget.Select
End With

End Sub


Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
How do I insert a combobox programmatically into a
specific cell, say B4, that exactly fits the size of the
cell?

Stefan
.



All times are GMT +1. The time now is 02:11 PM.

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