adding data to the bottom of my combobox.

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-04-07
I have used the following code:

Sheets("INTERFACE").ComboBox1.ListFillRange = Sheets("Doctor Info").Range(Cells(1, 3), Cells(r, 3)).Address

INTERFACE sheet is where the combobox is located.  "Doctor Info" sheet is where I want the data in the combobox to come from.  The range is going from cell "C1" to cell "Cr" where r is the next empty cell.  I think the problem is with the Address property.  ListFillRange is getting the appropriate assignment (C1:Cr), but it's putting in the values of the "C" column from the "INTERFACE" sheet and not the "Doctor Info" sheet.  How can I get it to read from the C column on "Doctor Info" sheet?

Can anyone help?
Question by:bladidivach
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

tgraffham earned 200 total points
ID: 7983014
The ListFillRange property accepts a string.  You're trying to set it to a Sheets object.

Try doing a little logic first to translate your:
    Sheets("Doctor Info").Range(Cells(1,3), Cells(r,3))

into the string:
    "'Doctor Info'!C1:C3'"

and then set ListFillRange property to that string.

I tested it and it worked fine.  However, you'll have to work out the logic for knowing what 'r' should be at each iteration of the code based on your particular situation.

Hope this helps.

Author Comment

ID: 7990501
I'm really not good at programming. How would I translate a range of cells from a referenced sheet into a string?


Author Comment

ID: 7990592
nevermind i figured out how to translate it.  that worked. thank you very much.

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question