Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert formula
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. "" - "") " wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert formula | Excel Discussion (Misc queries) | |||
how to insert a formula? | Excel Discussion (Misc queries) | |||
insert formula | Excel Worksheet Functions | |||
Insert a value into formula | Excel Discussion (Misc queries) | |||
insert a new row by formula | Excel Worksheet Functions |