A Form's Rowsourse Format

  • Thread starter Thread starter John T Ingato
  • Start date Start date
J

John T Ingato

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.
 
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
 
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
 
Back
Top