View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Listbox ColumnHeads




Mn.CboMfrOrd.Rowsource = MfrRange.Address(External:=True)
Mn.CboMfrOrd.ColumnHeads = True



This should work as well:
Mn.LstHsNm.RowSource = "List!Y2:Z102"
Mn.LstWlInd.RowSource = Mn.LstHsNm.RowSource


--
Regards,
Tom Ogilvy




Dave Baranas wrote in message
...
Hi All

I am working from the other side trying to get back to Excel where I
have lists for my Listboxes.

I have the code below working to do this

Sub PopulateLstBoxFromExcel()

Dim MfrRange As Range, MfrVal As Variant
Dim ObjXL As Object
Dim ObjActiveWkb As Object

Set ObjXL = GetObject(, "Excel.Application")
Set ObjActiveWkb = ObjXL.Application.ActiveWorkbook

With ObjActiveWkb

'Mfr Order
Set MfrRange = .Worksheets("List").Range("P2:P101")

MfrVal = MfrRange.Value
Mn.CboMfrOrd.List = MfrVal

End With

Set ObjActiveWkb = Nothing: Set ObjXL = Nothing

End Sub

I was not able to use the rowsource property like this below when I
was inside Excel

Mn.LstWlInd.RowSource = Mn.LstHsNm.RowSource = "List!Y2:Z102"

I am wondering if there is a way to use the Rowsource property on a
listbox when you are coming back into excel to get a list.

If not then I wonder if there is a way to get the variant to somehow
convert back to a string so I can feed it into the rowsource.

If not then I wonder if there is some black magic voodoo stuff to get
column heads turned on with having to use the rowsource property.

Any help in this direction would go a long way to conquer these evil
beasts for everyone:)

Regards,

Dave Baranas