PDA

View Full Version : Populate cells based on dropdown selection



paleaux
08-10-2011, 03:23 PM
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..

Kenneth Hobs
08-11-2011, 02:30 AM
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.

paleaux
08-11-2011, 06:38 AM
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 ?

Bob Phillips
08-11-2011, 08:36 AM
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))

paleaux
08-11-2011, 12:32 PM
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...

Bob Phillips
08-11-2011, 02:43 PM
Use conditional formatting http://www.xldynamic.com/source/xld.CF.html

paleaux
08-11-2011, 03:26 PM
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..

paleaux
08-12-2011, 05:24 AM
up !!