frsm
Active Member
- Joined
- Jun 19, 2006
- Messages
- 258
hi all
i use this vba code to insert the formulas , but i have something wrong the code work well then it stops to work and colors the lines after this line with yellow
here is the code
i hope i can find anyone help me
thanks alot
i use this vba code to insert the formulas , but i have something wrong the code work well then it stops to work and colors the lines after this line with yellow
Code:
Range("bz6:bz" & LastRow).Formula = "=IF((K6)-INT(K6)<0.3;ROUNDDOWN((K6);0);IF((K6)-INT(K6)>0.7;ROUNDUP((K6);0);INT(K6)+0.5))"
here is the code
Code:
LastRow = Range("k" & Rows.Count).End(xlUp).Row
Range("K6:K" & LastRow).Formula = "=l6/2"
Range("l6:l" & LastRow).Formula = "=SUM(D6:G6)/4+H6+I6+J6"
Range("t6:t" & LastRow).Formula = "=u6/2"
Range("u6:u" & LastRow).Formula = "=SUM(m6:p6)/4+q6+r6+s6"
Range("ac6:ac" & LastRow).Formula = "=ad6/2"
Range("ad6:ad" & LastRow).Formula = "=SUM(V6:Y6)/4+Z6+AA6+AB6"
Range("al6:al" & LastRow).Formula = "=am6/2"
Range("am6:am" & LastRow).Formula = "=SUM(AE6:AH6)/4+AI6+AJ6+AK6"
Range("au6:au" & LastRow).Formula = "=av6/2"
Range("av6:av" & LastRow).Formula = "=SUM(AN6:AQ6)/4+AR6+AS6+AT6"
Range("bd6:bd" & LastRow).Formula = "=be6/2"
Range("be6:be" & LastRow).Formula = "=SUM(AW6:AZ6)/4+BA6+BB6+BC6"
Range("bm6:bm" & LastRow).Formula = "=bn6/2"
Range("bn6:bn" & LastRow).Formula = "=SUM(BF6:BI6)/4+BJ6+BK6+BL6"
Range("bv6:bv" & LastRow).Formula = "=bw6/2"
Range("bw6:bw" & LastRow).Formula = "=SUM(BO6:BR6)/4+BS6+BT6+BU6"
Range("bz6:bz" & LastRow).Formula = "=IF((K6)-INT(K6)<0.3;ROUNDDOWN((K6);0);IF((K6)-INT(K6)>0.7;ROUNDUP((K6);0);INT(K6)+0.5))"
Range("ca6:ca" & LastRow).Formula = "=IF((T6)-INT(T6)<0.3;ROUNDDOWN((T6);0);IF((T6)-INT(T6)>0.7;ROUNDUP((T6);0);INT(T6)+0.5))"
Range("cb6:cb" & LastRow).Formula = "=IF((AC6)-INT(AC6)<0.3;ROUNDDOWN((AC6);0);IF((AC6)-INT(AC6)>0.7;ROUNDUP((AC6);0);INT(AC6)+0.5))"
Range("cc6:cc" & LastRow).Formula = "=IF((AL6)-INT(AL6)<0.3;ROUNDDOWN((AL6);0);IF((AL6)-INT(AL6)>0.7;ROUNDUP((AL6);0);INT(AL6)+0.5))"
Range("cd6:cd" & LastRow).Formula = "=IF((AU6)-INT(AU6)<0.3;ROUNDDOWN((AU6);0);IF((AU6)-INT(AU6)>0.7;ROUNDUP((AU6);0);INT(AU6)+0.5))"
Range("ce6:ce" & LastRow).Formula = "=IF((BD6)-INT(BD6)<0.3;ROUNDDOWN((BD6);0);IF((BD6)-INT(BD6)>0.7;ROUNDUP((BD6);0);INT(BD6)+0.5))"
Range("cf6:cf" & LastRow).Formula = "=IF((BM6)-INT(BM6)<0.3;ROUNDDOWN((BM6);0);IF((BM6)-INT(BM6)>0.7;ROUNDUP((BM6);0);INT(BM6)+0.5))"
Range("cg6:cg" & LastRow).Formula = "=IF((BV6)-INT(BV6)<0.3;ROUNDDOWN((BV6);0);IF((BV6)-INT(BV6)>0.7;ROUNDUP((BV6);0);INT(BV6)+0.5))"
Range("ch6:ch" & LastRow).Formula = "=IF((BX6)-INT(BX6)<0.3;ROUNDDOWN((BX6);0);IF((BX6)-INT(BX6)>0.7;ROUNDUP((BX6);0);INT(BX6)+0.5))"
Range("ci6:ci" & LastRow).Formula = "=IF((BY6)-INT(BY6)<0.3;ROUNDDOWN((BY6);0);IF((BY6)-INT(BY6)>0.7;ROUNDUP((BY6);0);INT(BY6)+0.5))"
Range("cq6:cq" & LastRow).Formula = "=cr6/2"
Range("cr6:cr" & LastRow).Formula = "=ROUND(SUM(CJ6:CM6)/4;1)+CN6+CO6+CP6"
Range("cz6:cz" & LastRow).Formula = "=da6/2"
Range("da6:da" & LastRow).Formula = "=SUM(CS6:CV6)/4+CW6+CX6+CY6"
Range("di6:di" & LastRow).Formula = "=dj6/2"
Range("dj6:dj" & LastRow).Formula = "=SUM(DB6:DE6)/4+DF6+DG6+DH6"
Range("dr6:dr" & LastRow).Formula = "=ds6/2"
Range("ds6:ds" & LastRow).Formula = "=SUM(DK6:DN6)/4+DO6+DP6+DQ6"
Range("ea6:ea" & LastRow).Formula = "=eb6/2"
Range("eb6:eb" & LastRow).Formula = "=SUM(DT6:DW6)/4+DX6+DY6+DZ6"
Range("ej6:ej" & LastRow).Formula = "=ek6/2"
Range("ek6:ek" & LastRow).Formula = "=SUM(EC6:EF6)/4+EG6+EH6+EI6"
Range("es6:es" & LastRow).Formula = "=et6/2"
Range("et6:et" & LastRow).Formula = "=SUM(EL6:EO6)/4+EP6+EQ6+ER6"
Range("fb6:fb" & LastRow).Formula = "=fc6/2"
Range("fc6:fc" & LastRow).Formula = "=SUM(EU6:EX6)/4+EY6+EZ6+FA6"
Range("ff6:ff" & LastRow).Formula = "=IF((CQ6)-INT(CQ6)<0.3;ROUNDDOWN((CQ6);0);IF((CQ6)-INT(CQ6)>0.7;ROUNDUP((CQ6);0);INT(CQ6)+0.5))"
Range("fg6:fg" & LastRow).Formula = "=IF((CZ6)-INT(CZ6)<0.3;ROUNDDOWN((CZ6);0);IF((CZ6)-INT(CZ6)>0.7;ROUNDUP((CZ6);0);INT(CZ6)+0.5))"
Range("fh6:fh" & LastRow).Formula = "=IF((DI6)-INT(DI6)<0.3;ROUNDDOWN((DI6);0);IF((DI6)-INT(DI6)>0.7;ROUNDUP((DI6);0);INT(DI6)+0.5))"
Range("fi6:fi" & LastRow).Formula = "=IF((DR6)-INT(DI6)<0.3;ROUNDDOWN((DR6);0);IF((DR6)-INT(DR6)>0.7;ROUNDUP((DR6);0);INT(DR6)+0.5))"
Range("fj6:fj" & LastRow).Formula = "=IF((EA6)-INT(EA6)<0.3;ROUNDDOWN((EA6);0);IF((EA6)-INT(EA6)>0.7;ROUNDUP((EA6);0);INT(EA6)+0.5))"
Range("fk6:fk" & LastRow).Formula = "=IF((EJ6)-INT(EJ6)<0.3;ROUNDDOWN((EJ6);0);IF((EJ6)-INT(EJ6)>0.7;ROUNDUP((EJ6);0);INT(EJ6)+0.5))"
Range("fl6:fl" & LastRow).Formula = "=IF((ES6)-INT(ES6)<0.3;ROUNDDOWN((ES6);0);IF((ES6)-INT(ES6)>0.7;ROUNDUP((ES6);0);INT(ES6)+0.5))"
Range("fm6:fm" & LastRow).Formula = "=IF((FB6)-INT(FB6)<0.3;ROUNDDOWN((FB6);0);IF((FB6)-INT(FB6)>0.7;ROUNDUP((FB6);0);INT(FB6)+0.5))"
Range("fn6:fn" & LastRow).Formula = "=IF((FD6)-INT(FD6)<0.3;ROUNDDOWN((FD6);0);IF((FD6)-INT(FD6)>0.7;ROUNDUP((FD6);0);INT(FD6)+0.5))"
Range("fo6:fo" & LastRow).Formula = "=IF((FE6)-INT(FE6)<0.3;ROUNDDOWN((FE6);0);IF((FE6)-INT(FE6)>0.7;ROUNDUP((FE6);0);INT(FE6)+0.5))"
i hope i can find anyone help me
thanks alot