I am having trouble adding values to the ActiveX listbox added to the sheet with the following code. I also don't know how to change the number of columns and the font characteristics of each column dynamically. Thanks for any help.
Sub loadBasisV()
Dim i As Integer
Dim j As Integer
Dim textB As String
Dim obj As OLEObject
Dim wsP As Worksheet
Dim wsB As Worksheet
Set wsP = Sheets("Print Sheets")
Set wsB = Sheets("Basis")
For Each obj In wsP.OLEObjects
obj.Delete
Next
obj = Nothing
wsP.Activate
If UserFormBasis.CheckBox9.Value = True Then
textB = UCase("Building Code: ")
Set obj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.ListBox.1", Left:=2515.5, Top:=336, Height:=300, Width:=684.75)
i = ActiveSheet.OLEObjects("ListBox1").Index
With obj
With .Object
.AddItem textB
.List(1, 2) = UCase(bldgCode)
End With
End With
End If
End Sub
Sub loadBasisV()
Dim i As Integer
Dim j As Integer
Dim textB As String
Dim obj As OLEObject
Dim wsP As Worksheet
Dim wsB As Worksheet
Set wsP = Sheets("Print Sheets")
Set wsB = Sheets("Basis")
For Each obj In wsP.OLEObjects
obj.Delete
Next
obj = Nothing
wsP.Activate
If UserFormBasis.CheckBox9.Value = True Then
textB = UCase("Building Code: ")
Set obj = ActiveSheet.OLEObjects.Add(ClassType:="Forms.ListBox.1", Left:=2515.5, Top:=336, Height:=300, Width:=684.75)
i = ActiveSheet.OLEObjects("ListBox1").Index
With obj
With .Object
.AddItem textB
.List(1, 2) = UCase(bldgCode)
End With
End With
End If
End Sub