+ Reply to Thread
Results 1 to 4 of 4

ComboList produces errors run-time error...

  1. #1
    Registered User
    Join Date
    03-07-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    10

    ComboList produces errors run-time error...

    Hello,

    Today I am trying to make a userform that uses a combo box, when you pick an item in the combo box I want to be able to click a Cmdbutton and have the selected item put into the active cell of a work sheet. I need it to be able to post to the active cell because there is no way of knowing which thing goes into what cell until you're doing it.

    Blah Blah Test ID
    Procedure Name&Desc 1 -------------------- Price
    Procedure Name&Desc 2 -------------------- Price
    Procedure Name&Desc 3 -------------------- Price

    That would be a very basic way of how the end result will hopefully look once it is pasted with the Procedure Name, Description and Price done from the user form so the only input is the Test ID (which I could even go on to add a text box to the user form later for that).

    However, I haven't even been able to get off the ground because I get a run time error already. "Run Time error 1004 Method 'Range' of object '_worksheet' failed". I have searched the web and it's mostly people just giving out code instead of actually explaining what the person did in the code that wasn't correct or why (no learning value to that if you don't know what you did)

    Please Login or Register  to view this content.
    I presume that I messed something up with the variables based on what the error says so I went and checked and my worksheet that the information is on is named Services. The range for the items name is named cItm,Description is named cDesc,and price is named cPrice. My combobox is named CmdItem. So I am kind of lost and really bad at VBA code /facepalm I will learn this one way or another.




    Thank you for your time!
    Last edited by radgrad; 03-13-2014 at 03:34 PM. Reason: tucking fypos

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: ComboList produces errors run-time error...

    First, whenever you need help with an error message, tell us which line of code causes the error. It will give a choice of End or Debug. Choose Debug to see what line of code caused the error. In this case it's obvious to me, but that's general advice.

    Second, it looks like you are trying to populate a combobox with values from a range of cells in sheet "Services". Most of your code looks OK to me. But what are you trying to refer to when you say

    Please Login or Register  to view this content.
    ?

    That syntax means that you are referring to a named range, and the name is "Services". Do you have such a named range in your worksheet? If not, what cells are you trying to refer to? You also have a worksheet named "Services" so maybe you are confusing how to refer to a range with how to refer to a worksheet. Normally this code would look something like this:

    Please Login or Register  to view this content.
    The range for the items name is named cItm,Description is named cDesc,and price is named cPrice
    Are these range names? You have a variable named cItm, but no variables for the other two, so it's very difficult to understand what you are trying to tell us in this sentence.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    03-07-2014
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: ComboList produces errors run-time error...

    Ah ok, yes I was confusing the two for some reason and was trying to tell it the whole work sheet instead of my named ranges. That actually cleared up my problem so thank you for calling my attention to that.

    As far as the variables I forgot that I hadn't defined the other two variables in the code I had typed (I actually had removed them previously and forgot that when I pasted that piece of code), but yes they are range names.

    Also, Since I imagine I will have a question again regarding this same project should I go ahead and reuse this thread or do I need to mark it solved and open a new one if a different question arises on this project.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: ComboList produces errors run-time error...

    First I am curious as to why you whited out your post. Usually we prefer to let the question stand in case someone comes along later with a similar issue.

    Did you get this corrected and working, or do you need more help?

    Anyway, I suppose that any new question that comes up is going to be completely different than your first question, so I recommend a new thread. The model we use here is that each thread should stand on its own, so if someone Googles a similar question they will find the thread. Including several questions in the same thread even if they are about the same project defeats that goal. Also your title would no longer indicate your current question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. If contains formula with index match formula produces errors
    By Nicole Matthews in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 07-31-2013, 07:39 PM
  2. [SOLVED] why this array produces an error?
    By BNCOXUK in forum Excel General
    Replies: 4
    Last Post: 12-03-2012, 11:54 AM
  3. Formula produces Error
    By treeleaf20 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-10-2009, 05:34 PM
  4. Clicking Red X on UserForm produces run-time error '91'
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2008, 04:38 PM
  5. [SOLVED] Input box cancel produces error
    By pkeegs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2006, 01:10 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1