Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Percent calculation in VBA codes

Status
Not open for further replies.

paulmtl

Programmer
Feb 25, 2005
27
CA
Hi all,

How to create the formula to calculate the percentage out of the total in general format can be used all along ? from myExcel.xls

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


22222 200 CCCCC 0.25
22222 200 CCCCC 0.25
22222 400 CCCCC 0.50
--------------
subtotal 800

22222 200 DDDDD 0.25
22222 200 DDDDD 0.25
22222 400 DDDDD 0.50
--------------
subtotal 800

I got the columns account , amount,classcode but need to calculate the percentage but be carefull , each time the account changes the formula of percentage should changed accordingly.

Please help me with the codes in VBA because I am newbie to
Excel-VBA to run as a macro or sub percent() for 10000 accounts in which it is not easy to do it with a single
formula.

Thanks in advance,
 
Take a look here:
thread707-1057331

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,

I appreciate that solution in the thread 707-1057331 but
I have to copy one by one that formula to each cell, it's
taking more times. That's why I need someone to help me to create the codes in VBA in a loop.

Thanks again,
 
TonyJollans said:
put this formula in C2 and [highlight]copy down[/highlight]
With the C2 cell active select the desired Cx cells and press Ctrl+B

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry to interfere, PHV, Ctrl+B -> Bold, did you mean Ctrl+D -> Fill Down?

Roy-Vidar
 
You're right Roy.
Seems the shortcut keys are localized:
Ctrl+B -> Copie Bas
 
Yeah, it's a pain - where I live, Ctrl+B is Find ;-)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top