View Single Post
 
Old 06-02-2013, 11:18 PM
Scheuerman1987 Scheuerman1987 is offline Windows Vista Office 2013
Novice
 
Join Date: May 2013
Location: Corona, CA
Posts: 4
Scheuerman1987 is on a distinguished road
Default How do you write a macro with an IF Function

I need to write a macro that does the following. I'm not very good with macros or VBA and I think my text book words this step really confusing. This is an extra credit assignment but I would still like to complete it. I have attached my workbook below so if anyone can help me write the code for the macro I'd really appreciate it.

Write a macro named Insert_Transaction to copy the transaction data from the Transaction worksheet and insert it at the top of the list of transactions in the Auction Account worksheet. (Hint: You can use the macro recorder to record the steps to copy sample data from the Transaction sheet to the Auction Account sheet.) The macro should include the following:

An If statement that verifies that there is enough money in the auction account to cover the transaction. If there is not enough money, the macro should prevent the transaction from being entered into the auction account and notify the user with a message box, indicating how much money is in the account.

If the transaction is covered by the account, copy the values from the Transaction worksheet into the Auction Account worksheet. After the values have been copied, use a message box to notify the user of a successful transaction along with the current account balance. Replace the values in the Transaction worksheet with blanks.

Test the macro by entering the data shown below in the order shown. Sales are entered as positive values and purchases are entered as negative values.

Date Description Item Amount

4/2/2013 Purchase Bach Trumpet with Mouth Piece - $165
4/4/2013 Sale King 1250 Flugelhorn $210
4/7/2013 Purchase Schiller Lightweight Trumpet - $350

https://docs.google.com/file/d/0B6iC...it?usp=sharing
Reply With Quote