Consulting

Results 1 to 8 of 8

Thread: Populate cells based on dropdown selection

  1. #1
    VBAX Regular
    Joined
    Aug 2011
    Posts
    17
    Location

    Populate cells based on dropdown selection

    I have a workbook with multiple sheets, what I am trying to do is fill in
    certain cells with rates when a particular craft is selected from a drop down box.

    Example:
    If Boilermaker is selected in drop down box in G2 located on "Timesheet" the it would populate the ST Rate in I2 of "Timesheet" & OT Rate K2 "Timesheet" & DTRate M2 "Timesheet" etc...

    The Rates are located in another worksheet "Labor Rates" and are assigned by Craft, so lets say Boilermaker is located in "Labor Rates" A2, then the ST Rate is in "Labor Rates" C2, OTRate is in "Labor Rates" D2.

    Is there a vba that will perform this function ?
    I would like to stay away from large IF statements if possible.

    Thanks in advance.. this is a great place..

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Please make your thread title more descriptive. This is important for the forum and to you to get people willing to look at your post.

    Sure, that is easily done by a Change event for the sheet with the cells that would trigger to updates.

    Another way to get on-target help, is to describe what you want with real data and then post the most simple workbook that shows your concept.

  3. #3
    VBAX Regular
    Joined
    Aug 2011
    Posts
    17
    Location
    Sorry should have posted the workbook in previous post..

    Example:
    If Boilermaker is selected in drop down box in G2 located on "Timesheet" the it would populate the ST Rate in I2 of "Timesheet" & OT Rate K2 "Timesheet" & DTRate M2 "Timesheet" etc...

    The Rates are located in another worksheet "Labor Rates" and are assigned by Craft, so lets say Boilermaker is located in "Labor Rates" A2, then the ST Rate is in "Labor Rates" C2, OTRate is in "Labor Rates" D2.

    Is there a vba that will perform this function ?
    Attached Files Attached Files

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Just use formulae

    =IF($G2="","",VLOOKUP($G2,Labor_Rates!$A:$E,3,FALSE))
    =IF($G2="","",VLOOKUP($G2,Labor_Rates!$A:$E,4,FALSE))
    =IF($G2="","",VLOOKUP($G2,Labor_Rates!$A:$E,5,FALSE))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Aug 2011
    Posts
    17
    Location
    Worked like a charm...Thanks..

    Have another question..

    Column H = ST Hours
    Column J = OT Hours
    Columnn L = DT Hours
    Column N = Total Hours wich is auto populated via vba from worksheet
    "Gate Log"

    Timekeepers will complete ST Hours, OT Hours and DT Hours
    Is is possible to have the entire Row turn Red if the Total Hours is exceeded by the Timekeepers data entry.

    Example:
    Column N = 14.00
    Timekeepers Data Entry ...(STHours)H2=5.00,(OTHours)J2=5.00,(Double Time Hours)L2=5.00
    This is a Total of 15 hours, then Row 2 Turns Red.

    By the way I truly appreciate all of your help...

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Use conditional formatting http://www.xldynamic.com/source/xld.CF.html
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    VBAX Regular
    Joined
    Aug 2011
    Posts
    17
    Location
    There is vba that populates Total Hours from Gate Log sheet, and there is a rounding function in place that carry's over into the cells located in
    Total Hours column N "Timesheet",
    So I am not exactly sure of how to use the Conditional Formatting.

    Would it be possible to get an example ?

    Thanks again for you help !! I am very grateful..

  8. #8
    VBAX Regular
    Joined
    Aug 2011
    Posts
    17
    Location
    up !!

Posting Permissions

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