ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   When do I need Rng.Address(External:=True) (https://www.excelbanter.com/excel-programming/348736-when-do-i-need-rng-address-external-%3Dtrue.html)

davidm

When do I need Rng.Address(External:=True)
 

I have created an Addin that contains a ListBox populated by a rowsourc
reference.
The Excel file component of the addin works fine but somehow th
Listbox fails to load up in its Addin enviroment. The relevant part o
the code reads:


ListBox1.RowSource="ef2:em" & [em65536].End(xlUp).Row

I vaguely sense this may be a classical case wher
Address(External:-True) may be required but I have lost my way a bit.

Thanks for any help.


Davi

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=49547


keepITcool

When do I need Rng.Address(External:=True)
 

your code will take the range from the activeworkbook.

better to do like:

Private Sub UserForm_Initialize()
With ThisWorkbook.Sheets(3).Columns("EF")
Me.ComboBox1.RowSource = Range( _
.Cells(2), _
.Cells(Rows.Count).End(xlUp) _
).Address(external:=True)
End With
End Sub


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


davidm wrote :


I have created an Addin that contains a ListBox populated by a
rowsource reference.
The Excel file component of the addin works fine but somehow the
Listbox fails to load up in its Addin enviroment. The relevant part
of the code reads:


ListBox1.RowSource="ef2:em" & [em65536].End(xlUp).Row

I vaguely sense this may be a classical case where
Address(External:-True) may be required but I have lost my way a bit.

Thanks for any help.


David



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

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