Monday, February 2, 2009

How to add two dollar amounts

'''''' To add the $ amounts''''''''''''''''

amount1 = inputbox("Enter the first dollar amount")
''''''Enter the amount with $ symbol Ex - $ 2000

amount2 = inputbox("Enter the second dollar amount")
'''''Enter the amount with $ symbol Ex - $ 3000

lnt1=len (amount1)
'To get the length of the dollar amount
lnt2=len(amount2)
' To get the length of the dollar amount

aamount1 = Right(amount1,lnt1-1)
'''''' To remove the dollar symbol and get the actual amount

aamount2= Right(amount2,lnt2 - 1)
''''''To remove the dollar symbol and get the actual amount

msgbox Cint(aamount1)+Cint(aamount2)