is it possible to store formula under a UDF
LOOKUP(WEEKDAY(T1),{1,2,3,4,5,6,7},{7,6,5,4,3,2,1} )
Hi. Just 2 cents. If I'm not mistaken, the above part might be reduced to
the following:
8-WEEKDAY(T1)
--
Dana DeLouis
Windows XP & Office 2003
"Tom Ogilvy" wrote in message
...
With Worksheets("Sheet1")
set rng = .Range(T2:T2000)
End With
rng.Formula =
"=IF(T1=LOOKUP(MAX(holidays),holidays),T1,IF(AND(W EEKDAY(T1)=1,LOOKUP(T1,holidays)=T1),T1+1,IF(OR(AN D(LOOKUP(T1,holidays)=T1,WEEKDAY(T1)=6),AND(LOOKUP (T1+2,holidays)=T1+2)),T1+1,MIN(T1+(LOOKUP(WEEKDAY (T1),{1,2,3,4,5,6,7},{7,6,5,4,3,2,1})),INDEX(holid ays,MATCH(T1,holidays,ROW(T1))+1)))))"
or
set rng = Range("N_WD")
then as above.
if you don't want the formula to refer to the cell above it, then you
would
need to add some dollar signs to fix the references. I have no idea what
you
are doing, so I can't say.
--
Regards,
Tom Ogilvy
<snip
|