+ Reply to Thread
Results 1 to 2 of 2

Having a macro check for changes in two drop down lists and fill in cells with data (2013)

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    1

    Having a macro check for changes in two drop down lists and fill in cells with data (2013)

    Hi, I am new to the forums and new to macros as well. I appreciate any help that you can give me.

    What I'm trying to do is have two drop down lists that are right next to each other, this is already done, and have a macro check these two lists. So far this is working. Then depending on what is entered into the cells, the macro will take data from another tab and insert it into another cell on the first page. I've accomplished this with one cell and it works fine. However whenever I try to make it import two values, which are right next to each other, it gives me the error "value" of object "range" failed. Below is a part of my code, there are many more if statements because there are many items in the drop down list, however it is not necessary to upload the entirety of it. I'm sure there may be better ways to write this rather than a TON of if statements, but I started it out this way so I'm continuing onward.





    Please Login or Register  to view this content.




    Edit: I have the macro in the sheets own module, just fyi. Also, the line I am trying to is "Worksheets("Automated Production Equipment").Cells(a, 6).Value = Worksheets("Production Equipment").Cells(13, 6).Value" Without this line everything works fine.



    Edit 2: I solved this by using Application.EnableEvents = False. Before any of my if statements I use Application.EnableEvents = True, then when I get into my if statement and it is found try, I first set it equal to False then do everything and then when it exits the if statement but before it ends sub, i set it back to true.
    Last edited by arlu1201; 09-21-2013 at 02:36 AM. Reason: Use code tags in future.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Having a macro check for changes in two drop down lists and fill in cells with data (2

    Welcome to the forum, 2 pointers -

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.

    Also, in future when you post the solution, its better you post it in post 2, so others can clearly make out which is the question and which is the answer.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Replies: 2
    Last Post: 09-07-2013, 03:55 AM
  2. Stock Check Spreadsheet / drop down lists
    By richardson.cr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-15-2011, 02:59 PM
  3. Auto fill with one of two drop down lists...?
    By Synthia in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-02-2010, 05:57 PM
  4. Macro to fill cells when a value is selected from Drop Down List
    By TRJJK73 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2009, 05:13 AM
  5. Drop-Down Lists: Can we fill 2 columns at the same time?
    By HarvardMajesty in forum Excel General
    Replies: 5
    Last Post: 05-18-2009, 09:07 PM

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