Need To Convert Expression To VBA (1 Viewer)

vdanelia

Registered User.
Local time
Today, 15:54
Joined
Jan 29, 2011
Messages
215
Hello Friends....
I have a question I need to rewrite my code which I made in Expression and need to convert to VBA, if it is available:
Code:
=[UnitPrice]*(((100-[Deprpercent])/100)^Int(Format(Date(),"yyyy\.mmdd")-Format([DateOfPurchase],"yyyy\.mmdd")))

the idea is: I Placed this code on unbound text box "Depreceation" in "DeprPercent" I enter the percent eg: 18% or 20% and after that it calculates yearly.

Thanks In Advanced
 

vbaInet

AWF VIP
Local time
Today, 22:54
Joined
Jan 22, 2010
Messages
26,374
It is already VBA. You can use it as it is.
 

vdanelia

Registered User.
Local time
Today, 15:54
Joined
Jan 29, 2011
Messages
215
Hi vbaInet
When I tested it In VBA, got some errors....
I'll Check everything precisely, I thought that it needed something other......
Thanks for the reply......
I'll Post the results
 

vdanelia

Registered User.
Local time
Today, 15:54
Joined
Jan 29, 2011
Messages
215
Solved! I Used
Code:
Me.DePreciation = Me.Unitprice * (((100 - Me.DePercent) / 100) ^ Int(Format(Date, "yyyy\.mmdd") - Format(Dateofpurchase, "yyyy\.mmdd")))
:)
 

Users who are viewing this thread

Top Bottom