View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Project Mangler Project Mangler is offline
external usenet poster
 
Posts: 63
Default Insert formula even cells with data below it

Not sure as to whether the formula does what you need, but this should be
nearer to working:

Sub Insertformula()
For Check = 4 To 40000 Step 2
If Cells(Check - 1, 2) < "" Then Cells(Check, 2) = "=IF(OR(I5=" & Chr(34) &
Chr(34) & ",J5 =" & Chr(34) & Chr(34) & ")," & Chr(34) & Chr(34) &
",NETWORKDAYS(I5,J5,Holidays!A$1:A$39)-1)"
Next Check
End Sub




"Jazz" wrote in message
...
Using this code

Sub Insertformula ()
For Check = 4 To 40000 Step 2
If Cells(Check, "b") < "" Then Cells(Check, "b") =
"=IF(OR(I5="",J5=""),"",NETWORKDAYS(I5,J5,Holidays !A$1:A$39)-1)"
Next Check
End Sub

My objective is to put this formula

=IF(OR(I5="",J5=""),"",NETWORKDAYS(I5,J5,Holidays! A$1:A$39)-1)

Into every even cell in Column B with data below it. However if you tried
the macro you would see it does not work. If I could get any help thank

you.