Session I Part 2.
To create Arithmetic function for decimal, you had to change type of parameters and the Function statements to. Change the code that shown at earlier article like this :
Function kali(addr As Currency, addr2 As Currency) As Currency
kali = addr * addr2
End Function
Function bagi(addr As Currency, addr2 As Currency) As Currency
bagi = addr / addr2
End Function
Function tbh(addr As Currency, addr2 As Currency) As Currency
tbh = addr + addr2
End Function
Function krg(addr As Currency, addr2 As Currency) As Currency
krg = addr - addr2
End Function

In summary function, we create function that definied in excel. worksheetsfunction, Now Add the following code to your macro :
Function jumlah(data As Range) As Currency
jumlah = Excel.WorksheetFunction.Sum(data)
End Function

In the your worksheet, semple macro will do like this :

It's so simple, I hope you interest with this, I like excel macro, you should to. Sorry for my english

0 comments:
Post a Comment