adding a listbox to a spreadsheet

  • Thread starter Thread starter philipl
  • Start date Start date
P

philipl

hi,

Does anyone have any code sample on how you would add/populate a
listbox in a spreadsheet?

thx
-Philip
 
Sub TesterAAA3()
Dim rng As Range
Set rng = ActiveSheet.Range("B9:C15")
With ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.ListBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=rng.Left, _
Top:=rng.Top, _
Width:=rng.Width, _
Height:=rng.Height)
.ListFillRange = "Sheet3!A1:A20"
End With

End Sub
 
Tom Ogilvy said:
Sub TesterAAA3()
Dim rng As Range
Set rng = ActiveSheet.Range("B9:C15")
With ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.ListBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=rng.Left, _
Top:=rng.Top, _
Width:=rng.Width, _
Height:=rng.Height)
.ListFillRange = "Sheet3!A1:A20"
End With

End Sub

thanks that gave me a start
 
Back
Top