ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RowSource not supported in Office for Macintosh (workaround?) (https://www.excelbanter.com/excel-programming/294401-rowsource-not-supported-office-macintosh-workaround.html)

Albert Chan

RowSource not supported in Office for Macintosh (workaround?)
 
Dear All,

Apparently, RowSource is not supported in Office for Mac, which is causing me a great deal of pain. The problem is this:

I have a userform with a ListBox that retreives data from a named range. In the Windows version of Excel, I can just set the ListBox to get data using RowSource (e.g. ListBox.RowSource = "NamedRange"). However, on the Mac, I have to do some meatball surgery (using arrays and a FOR loop) to populate the list. My current code for this task is not very efficient as shown below.

Dim ListArray(2000, 2) As String

With Worksheets("Data")
ListBox.ColumnCount = 2
For i = 0 To .Range("NamedRange").Rows.Count
ListArray(i, 0) = .Range("NamedRange").Cells(i + 1, 1)
ListArray(i, 1) = .Range("NamedRange").Cells(i + 1, 2)
Next
End With

ListBox.List() = ListArray

For a list that contains around 2000 rows, the load time for the userform is (somewhat) significant. Well, maybe it's not that significant (a slight lag), but it's annoying the hell out of me. With RowSource, the form loads almost instantly.

My question is, "is there an equivalent alternative to RowSource for the Mac version of Office?" Or, is there a more efficient way to load data into a ListBox other than arrays and loops?

Any help is much appreciated.

Regards,

Albert

Albert[_5_]

RowSource not supported in Office for Macintosh (workaround?)
 
Anyways, I probably wasn't thinking much before as I missed the obvious and simpler solution

ListBox.List = .Range("NamedRange").Valu

Hope this helps other Mac users out there

My only other beef is that ColumnHeader doesn't work because RowSource is not supported. I guess I'll just have to live with that, or do I

Albert


All times are GMT +1. The time now is 06:05 PM.

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