ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ComboBox RowSource (https://www.excelbanter.com/excel-programming/393894-combobox-rowsource.html)

Caleb Runnels

ComboBox RowSource
 
I am trying to populate a ComboBox RowSource in a form with a named range
from another workbook. I'm a little stumped. Any suggestions?



JLGWhiz

ComboBox RowSource
 
Here is one that I use in a procedure. It uses a variable length row source.

Private Sub UserForm_Initialize()
With Worksheets(3)
maxRw = .Cells(Rows.Count, 1).End(xlUp).Row
x = .Cells(maxRw, 1).Address
UserForm3.Caption = "SELECT STREET NAME"
With UserForm3.ListBox1
.RowSource = "Sheet3!$A$2:" & x 'This refers to other sheet range
.BoundColumn = 1
.ColumnCount = 1
.ListStyle = fmListStyleOption
End With
End With
End Sub


"Caleb Runnels" wrote:

I am trying to populate a ComboBox RowSource in a form with a named range
from another workbook. I'm a little stumped. Any suggestions?




Caleb Runnels

ComboBox RowSource
 
It's not quite exactly what I'm trying to do. That example would work fine
if I needed to use a different sheet in the same workbook, but I need to use
a complete different workbook...aka...different Excel file.


"JLGWhiz" wrote in message
...
Here is one that I use in a procedure. It uses a variable length row
source.

Private Sub UserForm_Initialize()
With Worksheets(3)
maxRw = .Cells(Rows.Count, 1).End(xlUp).Row
x = .Cells(maxRw, 1).Address
UserForm3.Caption = "SELECT STREET NAME"
With UserForm3.ListBox1
.RowSource = "Sheet3!$A$2:" & x 'This refers to other sheet range
.BoundColumn = 1
.ColumnCount = 1
.ListStyle = fmListStyleOption
End With
End With
End Sub


"Caleb Runnels" wrote:

I am trying to populate a ComboBox RowSource in a form with a named range
from another workbook. I'm a little stumped. Any suggestions?






Tom Ogilvy

ComboBox RowSource
 
Assuming the other workbook is open then:

..RowSource =
workbooks("Otherbook.xls").Names("MyName").Referst oRange(0,0,xlA1,True)

--
Regards,
Tom Ogilvy


"Caleb Runnels" wrote:

It's not quite exactly what I'm trying to do. That example would work fine
if I needed to use a different sheet in the same workbook, but I need to use
a complete different workbook...aka...different Excel file.


"JLGWhiz" wrote in message
...
Here is one that I use in a procedure. It uses a variable length row
source.

Private Sub UserForm_Initialize()
With Worksheets(3)
maxRw = .Cells(Rows.Count, 1).End(xlUp).Row
x = .Cells(maxRw, 1).Address
UserForm3.Caption = "SELECT STREET NAME"
With UserForm3.ListBox1
.RowSource = "Sheet3!$A$2:" & x 'This refers to other sheet range
.BoundColumn = 1
.ColumnCount = 1
.ListStyle = fmListStyleOption
End With
End With
End Sub


"Caleb Runnels" wrote:

I am trying to populate a ComboBox RowSource in a form with a named range
from another workbook. I'm a little stumped. Any suggestions?







Dave Peterson

ComboBox RowSource
 
Just a typo alert:

..RowSource = workbooks("Otherbook.xls").Names("MyName") _
.ReferstoRange.address(0,0,xlA1,True)

(added .address)

Tom Ogilvy wrote:

Assuming the other workbook is open then:

.RowSource =
workbooks("Otherbook.xls").Names("MyName").Referst oRange(0,0,xlA1,True)

--
Regards,
Tom Ogilvy

"Caleb Runnels" wrote:

It's not quite exactly what I'm trying to do. That example would work fine
if I needed to use a different sheet in the same workbook, but I need to use
a complete different workbook...aka...different Excel file.


"JLGWhiz" wrote in message
...
Here is one that I use in a procedure. It uses a variable length row
source.

Private Sub UserForm_Initialize()
With Worksheets(3)
maxRw = .Cells(Rows.Count, 1).End(xlUp).Row
x = .Cells(maxRw, 1).Address
UserForm3.Caption = "SELECT STREET NAME"
With UserForm3.ListBox1
.RowSource = "Sheet3!$A$2:" & x 'This refers to other sheet range
.BoundColumn = 1
.ColumnCount = 1
.ListStyle = fmListStyleOption
End With
End With
End Sub


"Caleb Runnels" wrote:

I am trying to populate a ComboBox RowSource in a form with a named range
from another workbook. I'm a little stumped. Any suggestions?







--

Dave Peterson


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

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