+ Reply to Thread
Results 1 to 4 of 4

VBA code to fill in from a drop-down menu

  1. #1
    Registered User
    Join Date
    10-23-2006
    Posts
    79

    VBA code to fill in from a drop-down menu

    Hi

    I am really (really, really..) rusty on my VBA and have looked at numerous examples for the last few hours but cannot find one that is 1) exactly what I need; or 2) most importantly, simple enough for me to understand what it is doing!

    I have a yearly sheet (i.e. "2010", "2011", "2012" etc) with columns called Manager (col A), Dept (Col B) and outcome (Col C). There is a drop-down in Column A that is pulling the manager's from a list on another page called "Lists". Lists contains the lists for the 3 columns in same Columns - A, B and C.

    When the manager is selected in column A, I need to populate the department name in column B automatically from the list in Column B on sheet called "Lists". The user populates Col C from the drop-down.

    I had it set up doing a vlookup which did exactly what I wanted! The problem was that excel was calculating every time something changed in the file and stayed 'in limbo' until it did its calculations! Unfortunately this is not practical for my workplace

    Can anyone help provide a macro (that works on the cell - Worksheet change?) and fills-in Col B when the cell in Col A is populated from the drop-down? I thought about doing a loop for the 45 departments but then that may be making the same problem of running the loop and sending file 'in limbo'.

    I tried to attach an example file but the button wont let me...(??? not sure why??? as options just say IMG is off!)

    Any help is appreciated.

    (If not too much bother, can you add comments too so I understand what it is doing as I am trying to learn?)

    I will keep looking when I get home tonight but if anyone can spare a moment that would be great.

    dugong

  2. #2
    Registered User
    Join Date
    04-09-2012
    Location
    São Paulo, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: VBA code to fill in from a drop-down menu

    Try to disable the automatic calculating for your workbook, just when they are saving the file.

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: VBA code to fill in from a drop-down menu

    To turn off automatic calculation:

    Office Button >> Excel Options >> Formulas >> 'Calculation Options' >> 'Workbook Calculation' >> 'Manual'

    Under this setting you can press F9 when you are ready for a calculation to occur.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  4. #4
    Registered User
    Join Date
    10-23-2006
    Posts
    79

    Re: VBA code to fill in from a drop-down menu

    Hi

    Thanks for the replies but the file will be loaded onto a server that others can access so I can't really set it to be manually recalculated.

    I have been looking at lots of VBA Macro examples but am not sure how to do a macro to, once the cell is filled from drop-down, to fill in the adjacent cell with information in a list from another spreadsheet.

    Any help once again appreciated...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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