TIP: Click on subject to list as thread! ANSI
echo: ms_word
to: ALL
from: TIM NORTON
date: 1997-04-24 22:59:00
subject: auto calc table

I am trying to write a quotation program where I cut some data from a dbase 
file and then paste it into a table. This part is no problem. I then need to 
automatically calculate a tax in price, total price for each line then a 
grand totalSub
        item            qty     cost    tax in  total
        ---------------------------------------------
        xxxxx           2       10      12.2    24.4
        rrrrr           4       20      24.4    48.8
                                        total   73.2
I would also like it to work out how many items there are and place the grand 
total 2 line after this.
I can do something like this in excel with the following macro but I can't 
make it work either by inserting an excel sheet into work as the macro wont 
run or by trying to modify the macro to run on a work table.
Please help
Tim Norton
Sub Macro1()
    Range("A1").Select
    ActiveSheet.Paste
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "=(RC[-1])+(RC[-1])*0.22"
    Range("E1").Select
    Selection.AutoFill Destination:=Range("E1:E4"), Type:=xlFillDefault
    Range("E1:E4").Select
    ActiveCell.Offset(0, 1).Range("A1").Select
    ActiveCell.FormulaR1C1 = "=(RC[-1])*(RC[-3])"
    Selection.AutoFill Destination:=ActiveCell.Range("A1:A4"), Type:= _
        xlFillDefault
    ActiveCell.Range("A1:A4").Select
    ActiveCell.Offset(5, -1).Range("A1").Select
    ActiveCell.FormulaR1C1 = "Total"
    ActiveCell.Offset(0, 1).Range("A1").Select
        ActiveCell.Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-5]C:R[-1]C)"
    ActiveCell.Offset(1, 0).Range("A1").Select
End Sub
--- Maximus 3.01
---------------
* Origin: SA Country Club II BBS (3:800/3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.