ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ListBox RowSource set to range of in-active sheet - possible? (https://www.excelbanter.com/excel-programming/378624-listbox-rowsource-set-range-active-sheet-possible.html)

What-A-Tool

ListBox RowSource set to range of in-active sheet - possible?
 
I am trying to set a listbox RowSource to a range of cells on another,
in-active sheet. Is this possible?

Using this give me the range of the active sheet :
lstAddress.RowSource = "A4:E4"
What needs to be added to make this reference another sheet?

Thanks - Sean



Dave Peterson

ListBox RowSource set to range of in-active sheet - possible?
 
I like to do it this way:

dim myRng as range
....
set myrng = worksheets("sheet9999").range("a4:e4")
....
lstAddress.rowsource = myrng.address(external:=true)

Try
msgbox myrng.address(external:=true)
and you'll see what that does.

What-A-Tool wrote:

I am trying to set a listbox RowSource to a range of cells on another,
in-active sheet. Is this possible?

Using this give me the range of the active sheet :
lstAddress.RowSource = "A4:E4"
What needs to be added to make this reference another sheet?

Thanks - Sean


--

Dave Peterson


All times are GMT +1. The time now is 08:15 AM.

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