insert formula

T

trobinson

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"",F15>0),"
- ",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
 
C

Charlie

It appears at a glance that you still have work to do on your "doubled-up"
quote marks within the string value.

Selection.Formula = "=IF(AND(OR($D$2=30,$D$2=60),D15=""aprent"")," -

(it looks good up to ""aprent"", but need to double-up quote marks beyond
that, i.e. "" - "")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top