Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Control Source / Row Source very unstable

Hi guys,

I've read a lot of posts and they don't agree on how to reference cells in
the Control Source and the Row Source Proprieties of a ListBox or ComboBox.
I've tried the short form ("Sheet1!A1") and the long form
(Workbooks("Book1").Worksheets("Sheet1").Range("A1 ") or even the longer one,
with .Address at the end. NONE OF THESE ARE STABLE. They sometimes work and
sometimes, I get the "Could not set Property Value....."

Isn't there ONE RIGHT way to tell a control where to get its data? If not,
then what are the rules for using one instead of the other?

Thanks for lighting my path,
Marc

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Control Source / Row Source very unstable

In the case of listbox and combobox, there is more than one way. You can
fill them with the Initialize process in code by using the AddItem method
(See VBA help). A second way, using code is:

With Worksheets(YourSheetNumber)
Set lb = .Shapes.AddFormControl(xlListBox, 100,10,100,100)
lb.ControlFormat.ListFillRange = "A1:A10"
End With

This creates the ListBox, positions it and sizes it while specifying the
range where the data resides that will be displayed in the listbox.

I have yet to find where it explains how to put a header in the box using
code.

"Marc Gendron" wrote:

Hi guys,

I've read a lot of posts and they don't agree on how to reference cells in
the Control Source and the Row Source Proprieties of a ListBox or ComboBox.
I've tried the short form ("Sheet1!A1") and the long form
(Workbooks("Book1").Worksheets("Sheet1").Range("A1 ") or even the longer one,
with .Address at the end. NONE OF THESE ARE STABLE. They sometimes work and
sometimes, I get the "Could not set Property Value....."

Isn't there ONE RIGHT way to tell a control where to get its data? If not,
then what are the rules for using one instead of the other?

Thanks for lighting my path,
Marc

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
Syntax for control source in combo box control dhstein Excel Discussion (Misc queries) 1 August 12th 09 05:38 PM
How change link source in long formula when source moved Irina Excel Programming 4 June 28th 06 07:27 AM
Text Box Control Source Richard Excel Programming 6 May 17th 04 02:17 PM
Control Source Dave D[_3_] Excel Programming 1 April 28th 04 07:20 PM
Control Source Steven Taylor[_2_] Excel Programming 0 July 16th 03 04:01 PM


All times are GMT +1. The time now is 03:25 PM.

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

About Us

"It's about Microsoft Excel"