Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 14th, 2005, 10:09 AM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtotal yogeshyl SQL Language 1 July 15th, 2008 02:16 PM
Top percent Query acting strangely in access 2002 jeremy1048 Access 4 January 15th, 2008 09:27 AM
how to add 6 percent to a number? keyvanjan Classic ASP Basics 2 October 10th, 2007 11:31 AM
Wont Give me a Percent Odifius Access VBA 2 September 21st, 2006 12:24 PM
Can't Get Percent Format to Work Properly twsinc Access VBA 2 November 19th, 2004 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.