Inserting a combobox

  • Thread starter Thread starter Stefan
  • Start date Start date
S

Stefan

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

Stefan
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top