percent of subtotal
> I start to code for calculating the percentage for myexcel.xls that
contains :
>
> account amount classcode percentage
>
> 11111 100 AAAAA 0.16
> 11111 200 AAAAA 0.34
> 11111 300 AAAAA 0.50
> ---------------
> subtotal 600
>
> 11111 100 BBBBB 0.16
> 11111 200 BBBBB 0.34
> 11111 300 BBBBB 0.50
> ---------------
> subtotal 600
>
>
> here is the codes:
>
> begins in row 17 and column 6 (account) & col 8 ( Amount )
> ---------------------------------
> For r = 17 To 19
> c = 8
> lcAmt = ActiveSheet.Cells(r, c).Value
>
> For x = 17 To 20
>
> lcAcct = ActiveSheet.Cells(x, 6).Value
>
> If lcAcct = " " Then
>
> lcSubtotal = ActiveSheet.Cells(x, c).Value
>
> End If
>
> Next
>
> lcPercent = lcAmt / lcSubtotal
>
> Range("T2").Value = lcPercent
>
> Next
> ---------------------------------------
>
> it only works for the first subtotal of 600, how to do the next loop in
the subtotal of 800 , I need your help if it possible.
>
> Thanks in advance.
|