LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Fill cell values on Interiorcolor conditions

Having Sheet1 containing number of people per Resource and Week,
Sheet2 Range E2:I10 contains number of hours per Resource and week
based on interiorcolor and forecolor of each Cell in Sheet1 Range
E2:I10
InteriorColor = None = 8 hours per day RGB 255,255,255
InteriorColor = Light Green = 9 hours per day RGB 153,255,153
InteriorColor = Light Yellow = 10 hours per day RGB 255,255,102
ForeColor = Black = 5 days a week ColorIndex 1
ForeColor = Blue = 6 days a week ColorIndex 5
ForeColor = Red = 7 days a week ColorIndex 3
Sheet3 Range E2:I10 contains Cost per Resource and Week
Based on Hours in Sheet2 Range E2:I10 * Average Rate in Sheet1 Range
B2:B10
Sheet1 Range C2:C10 contains Total Hours per Resource from Sheet2
Range E2: I10
Sheet1 Range D2:D10 contains Total Cost per Resource from Sheet3 Range
E2 : I10
Sheet1 header is as follows :
Resource, AvgRate, Hours, Cost, Week1, Wk2, Wk3, Wk4, Wk5
Aside from my syntax needing correction, how will I address my
variable
iCol for Cell Interiorcolor if it is not a ColorIndex value but an RGB
value ?
---- Pseudo Code --------------
Sub Cost()
Dim ws1,ws2, ws3 as Worksheets
Dim rng as Range
Dim iCol as ? ' InteriorColor
Dim fCol as Integer ' forecolor
Dim AvgRate as Integer
Set rng as Range(E2:I10)
set ws1 as ThisWorksheet

--------------------------------------------------------------
For Each Cell in rng
AvgRate = ActiveCell(Row,"B")
iCol = ActiveCell.Interiorcolor : fCol = ActiveCell.Forecolor
Select Case iCol
Case is …. ' Light Green
Select Case fColor
Case 5 ' Blue
ws2.ActiveCell.value = ws1.ActiveCell.Value * 9 *
6
ws3.ActiveCell.value = ws1.ActiveCell.Value * 9 *
6 * AvgRate
Case 3 ' Red
ws2.ActiveCell.value = ws1.ActiveCell.Value * 9 *
7
ws3.ActiveCell.value = ws1.ActiveCell.Value * 9 *
7 * AvgRate
Case Else ' Black
ws2.ActiveCell.value = ws1.ActiveCell.Value * 9
* 5
ws3.ActiveCell.value = ws1.ActiveCell.Value * 9
* 5 * AvgRate
End Select
Case is …. ' Light Yellow
Select Case fColor
....
Case Else
....
End Select
Next Cell
'Sum Hours from ws2 to ws1 Column "C"
Set rng as Range(C2:C10)
For Each Cell in rng
Sum ws2(Row:"E:I")
Next Cell
'Sum Cost from ws3 to ws1 Column "D"
Set rng as Range(D2:D10)
For Each Cell in rng
Sum ws3(Row:"E:I")
Next Cell
End Sub

Thank you for your help

Celeste
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a blank cell with a value using if conditions rjagathe New Users to Excel 7 December 20th 09 12:22 PM
Using range to fill in cell values Nicole Excel Programming 3 July 30th 07 06:54 PM
Isolate and total cell values based on conditions jkl Excel Discussion (Misc queries) 2 May 10th 07 03:53 AM
Auto Fill Color of a particular Cell if conditions are put Akash Excel Programming 8 January 4th 07 12:55 PM
Cell values based upon multiple conditions Ryan M via OfficeKB.com New Users to Excel 2 July 19th 05 02:10 AM


All times are GMT +1. The time now is 03:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"