Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default RowSource in Property Dialog

I use the following to populate a combobox on a form - Data is not bound.

Private driver() as String, tbl as Range, i as Integer

Private Sub UserForm_Initialize()
Set tbl = Sheets(3).Range("C1").CurrentRegion.Offset(1, 0)
ReDim driver(0 To tbl.Rows.Count - 2)
For i = 0 To tbl.Rows.Count - 2
driver(i) = Sheets(3).Cells(i + 2, 3)
Next i
cboDriver.List() = driver
End Sub

1. I would like to set the RowSource property in Properties but cannot find
the right syntax. What should this be?

2. Which way is 'more correct', setting this from the Properties Dialog or
in the Initialize Event?


Geoff

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default RowSource in Property Dialog

Hi Toppers

I would agree with what you say about the syntax however something is not
right.

I'm trying to eliminate unnecessary code in the initialise event by
inserting a reference to the data in the properties dialog.

BTW It was my belief that anything written in theinitialise event always
overrode any properties set in the dialog box. No???

Geoff

"Toppers" wrote:

Geoff,
Are you doing this in VBA or in the properties table of the
combobox1 - I was assuming the latter? If so, my previous options should work.

If it is in VBA:

ComboBox1.RowSource = "Sheet1! a1: a5"

ComboBox1.RowSource = "MyData"

HTH


"Geoff" wrote:

Hi

I have tried:
Sheet3!C1:C10
Sheets("Sheet3").Range("C1").CurrentRegion.Offset( 1, 0)
Sheets(3).Range("C1").CurrentRegion.Offset(1, 0)
ThisWorkBook.Sheets(3).Range("C1").CurrentRegion.O ffset(1, 0)
None are accepted.

????

Geoff

"Toppers" wrote:

1. ROWSOURCE Sheet3!A1:A10 will set to to A1:A10 from Sheet3.

If the above data is a named range (say "MyData") then set RowSource to
"MyData" (no quotes) (at least in XL2003)

Once Rowsource is set it cannot be changed by Userform_Initialise.

2. I don't think one is more correct than the other.


XL2003

HTH

"Geoff" wrote:

I use the following to populate a combobox on a form - Data is not bound.

Private driver() as String, tbl as Range, i as Integer

Private Sub UserForm_Initialize()
Set tbl = Sheets(3).Range("C1").CurrentRegion.Offset(1, 0)
ReDim driver(0 To tbl.Rows.Count - 2)
For i = 0 To tbl.Rows.Count - 2
driver(i) = Sheets(3).Cells(i + 2, 3)
Next i
cboDriver.List() = driver
End Sub

1. I would like to set the RowSource property in Properties but cannot find
the right syntax. What should this be?

2. Which way is 'more correct', setting this from the Properties Dialog or
in the Initialize Event?


Geoff

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default RowSource in Property Dialog

1. ROWSOURCE Sheet3!A1:A10 will set to to A1:A10 from Sheet3.

If the above data is a named range (say "MyData") then set RowSource to
"MyData" (no quotes) (at least in XL2003)

Once Rowsource is set it cannot be changed by Userform_Initialise.

2. I don't think one is more correct than the other.


XL2003

HTH

"Geoff" wrote:

I use the following to populate a combobox on a form - Data is not bound.

Private driver() as String, tbl as Range, i as Integer

Private Sub UserForm_Initialize()
Set tbl = Sheets(3).Range("C1").CurrentRegion.Offset(1, 0)
ReDim driver(0 To tbl.Rows.Count - 2)
For i = 0 To tbl.Rows.Count - 2
driver(i) = Sheets(3).Cells(i + 2, 3)
Next i
cboDriver.List() = driver
End Sub

1. I would like to set the RowSource property in Properties but cannot find
the right syntax. What should this be?

2. Which way is 'more correct', setting this from the Properties Dialog or
in the Initialize Event?


Geoff

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RowSource in Property Dialog Geoff Excel Programming 1 March 26th 06 11:52 PM
RowSource in Property Dialog Toppers Excel Programming 0 March 26th 06 11:47 PM
Rowsource Property Mohan Excel Programming 2 February 14th 05 07:41 PM
Runtime error 380: Could not set the List property. invalid property value of listbox jasgrand Excel Programming 0 October 6th 04 09:28 PM
Could not set the RowSource property Tom Ogilvy Excel Programming 0 August 17th 04 07:48 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"