Thread: insert formula
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] trobinson@ntsdevco.com is offline
external usenet poster
 
Posts: 1
Default insert formula

Hello,
I thought I posted this, but I did not see it on the website.

I need help with inserting a formula into a selected range. After I
insert this formula I want to copy this formula down to the other rows
of the spreadsheet with the text 'target renewal'. When I try to simply
insert the formula the first time, I get 'Type mismatch error'. I have
not tried to copy yet, cause I can't even insert the formula. I am
lost, can someone help me.

Thanks


For intx = 1 To lngrow
Cells(intx, 1).Select
If InStr(1, ActiveCell.Value, " Target Renewal") 0
Then
Range(Cells(intx, 6), Cells(intx, 20)).Select
Selection.Formula =
"=IF(AND(OR($D$2=30,$D$2=60),D15=""aprent"")," -
",IF(OR(E19=$B$2*(1-($D$2/30)),E19=$B$2*(1-(($D$2-30)/30)),E19=$B$2*(1-(($D$2-60)/30)),E19=$B$2*(1-(($D$2-90)/30)),E19=$B$2),$B$2,IF((F15+$D$2)<30,$B$2*(1-($D$2/30)),IF(OR(D15=""aprent"",F150),"
- ",IF((F15+E15+$D$2)<60,$B$2*(1-(($D$2-30)/30)),IF(D19=""," -
",IF((D15+E15+F15+$D$2)<90,$B$2*(1-(($D$2-60)/30))," - ")))))))"
Selection.Value = Selection.Value
End If
Next