ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A Form's Rowsourse Format (https://www.excelbanter.com/excel-programming/279651-forms-rowsourse-format.html)

John T Ingato

A Form's Rowsourse Format
 
1) Is it true that the rowsourse format must be equivalent to an Excel
reference, for example

RepEntryBox.RowSource = "'Names'!A1:A5" & NameCount

or using a variable

RepEntryBox.RowSource = "'Names'!A1:A" & NameCount


2) Or is it possible to set this property in a VBA format

Rowsource = Range(cells(1,1), (1,5)) or even

Rowsource = MyRange;... where MyRange is set to a range obj.



Leo Heuser[_2_]

A Form's Rowsourse Format
 
John

No problem, as long as the rowsource points to
an address.

E.g.
Set Block1 = Sheets("Sheet1").Range("D1:D5")
Me.ListBox1.RowSource = Block1.Address


Set Block2 = Range(Cells(1, 4), Cells(5, 4))
Me.ListBox1.RowSource = Block2.Address


--
Best Regards
Leo Heuser
Excel MVP
Followup to newsgroup only please.



"John T Ingato" skrev i en meddelelse
...
1) Is it true that the rowsourse format must be equivalent to an Excel
reference, for example

RepEntryBox.RowSource = "'Names'!A1:A5" & NameCount

or using a variable

RepEntryBox.RowSource = "'Names'!A1:A" & NameCount


2) Or is it possible to set this property in a VBA format

Rowsource = Range(cells(1,1), (1,5)) or even

Rowsource = MyRange;... where MyRange is set to a range obj.





Leo Heuser[_2_]

A Form's Rowsourse Format
 
If data is on a sheet that is not active,
when you open the userform use this
version:

Set Block1 = Sheets("Sheet1").Range("D1:D5")
Me.ListBox1.RowSource = Block1.Address(external:=True)

(External:=True) includes the path to Address.

LeoH


"Leo Heuser" skrev i en meddelelse
...
John

No problem, as long as the rowsource points to
an address.

E.g.
Set Block1 = Sheets("Sheet1").Range("D1:D5")
Me.ListBox1.RowSource = Block1.Address


Set Block2 = Range(Cells(1, 4), Cells(5, 4))
Me.ListBox1.RowSource = Block2.Address


--
Best Regards
Leo Heuser
Excel MVP
Followup to newsgroup only please.



"John T Ingato" skrev i en meddelelse
...
1) Is it true that the rowsourse format must be equivalent to an Excel
reference, for example

RepEntryBox.RowSource = "'Names'!A1:A5" & NameCount

or using a variable

RepEntryBox.RowSource = "'Names'!A1:A" & NameCount


2) Or is it possible to set this property in a VBA format

Rowsource = Range(cells(1,1), (1,5)) or even

Rowsource = MyRange;... where MyRange is set to a range obj.








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

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