OK, try this:
Sub hotherpsTest()
Range("D2:AB17").Formula = _
"=IF(AND(D$1=$B2,D$1<=$C2,$E$24=$AC$1,$AC2=""X"", $E34$E25),$E$24,"""")"
Range("D2:AB17").Value = Range("D2:AB17").Value
End Sub
It generates formulae from:
=IF(AND(D$1=$B2,D$1<=$C2,$E$24=$AC$1,$AC2="X",$E3 4$E25),$E$24,"")
to:
=IF(AND(AB$1=$B17,AB$1<=$C17,$E$24=$AC$1,$AC17="X ",$E49$E40),$E$24,"")
Then it converts the formulae to values. Voila.
However, I don't know if it gives the answer you expect.
D2 to AA2 = "Pick"
G3 to O3 = "Pick"
D4 to R4 = "Pick"
No "Packs" or "Alps"
Maybe you then need another routine to fill the blanks with another formula
?
You could use something like:
Sub hotherpsTest2()
On Error Resume Next
Range("D2:AB17").SpecialCells(xlCellTypeBlanks).Fo rmula = "=""x"""
On Error GoTo 0
End Sub
So combining the two:
Sub hotherpsTest3()
On Error Resume Next
Range("D2:AB17").Formula = _
"=IF(AND(D$1=$B2,D$1<=$C2,$E$24=$AC$1,$AC2=""X"", $E34$E25),$E$24,"""")"
Range("D2:AB17").Value = Range("D2:AB17").Value
Range("D2:AB17").SpecialCells(xlCellTypeBlanks).Fo rmula = "=""x"""
Range("D2:AB17").Value = Range("D2:AB17").Value
On Error GoTo 0
End Sub
Regards
Trevor
"hotherps " wrote in message
...
Yes Trevor i could have been more specific but as you noticed, I'm not
getting any replies so I'm kind of giving up on the idea, but here is
how it goes.
To answer your question, Yes I want that formula evaluated for each
cell in the row, and for the rest of the range for that matter. But to
copy it in every cell would make the file huge. The logic behind it
is:
If an employee's (A) startTime(B) and EndTime(C) is between the time of
day Range(D1:EI1) and the employee is trained in that task(AK1 = "x")
and the task requires hours(E25 0)
Fill in the task name(E24) in each cell of the range the original
range(D2:DI2) after this row is populated drop down to the next row and
do the same thing until the hours required(E25 = 0)
Then move to the next column (E26) and do the same thing and so on...
Thanks
Attachment filename: schedulesample.xls
Download attachment:
http://www.excelforum.com/attachment.php?postid=512357
---
Message posted from http://www.ExcelForum.com/