MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Help with macro to sort, subtotal, total


Posted by Julia on February 01, 2002 9:49 AM

I have to post checks every day. I have a macro set up to allow me to enter -data (check ID), go to column B (amount) -enter data, go column C (description), enter - next row. This lets me do all data entry with the keypad. I then have to manually sort data by column A, then manually subtotal and total column B. Is there a way to add to my existing macro to do this or do I need to run another. Also could this be set up to AutoRun. Here is my macro Thanks in advance.

Sub enter_data()
newdata:
ActiveCell = InputBox("Check ID?", vbOKCancel)
ActiveCell.Offset(0, 1).Select
ActiveCell = Format(Val(InputBox("Amount?", vbOKCancel) / 100), "0.00")
ActiveCell.Offset(0, 1).Select
ActiveCell = InputBox("Description?", vbOKCancel)
ActiveCell.Offset(1, -2).Select
ans = MsgBox("Next dataset. Continue?", vbOKCancel)
If ans = vbOK Then
GoTo newdata
Else: Exit Sub
End If
End Sub


Posted by Borachio on February 01, 2002 3:44 PM

Use the macro recorder to get the code for your sort and sub-totals, and then copy and paste the code into your macro.

Posted by Julia on February 01, 2002 4:12 PM


Thank you very much Borachia

Posted by Julia on February 01, 2002 4:58 PM

Help Again Borachia


Thank you very much Borachia

I'm sorry but either I have the wrong code or I am not putting it in the right place in the exiting macro. Could you give example. If I can see it I can understand it. Thanks again Julia

Posted by Borachio on February 01, 2002 9:28 PM

Re: Help Again Borachia


Don't know how else to explain it.
Post the code you recorded and explain at what point you want it to run in your existing macro.
Also post your existing macro including the code you added (if I can see it I might be able to understand it).