Hi Anton,Glad it works well for you.To keep the cursor in the same cell, add the following line to your code:Target.Select So the macro will now look like this: Private Sub Worksheet_Change(ByVal Target As Range)If Target.Column = 2 Then Target.Offset(0, 1) = Target.Offset(0, 1) + TargetTarget.SelectEnd Sub Regards - Dave.
> Date: Thu, 24 Jun 2010 10:25:48 -0700 > Subject: Re: $$Excel-Macros$$ how to get cumulative sum in a cell > From: a...@kwic.com > To: excel-macros@googlegroups.com > > Hi Dave, > your code works very well. it seems to work for text in col B which > gives the same text in col C. I decided to make 2 columns for every > month of the year. so i just added more similar lines "if target =4 > etc", if target =6 etc in your code. we still have all the accounts on > paper for every month if needed.(we write down expenses etc in a book > each day but only enter data in spreadsheet once a year) This will > save us the trouble of adding up each grocery expense etc by hand for > each month and then entering it in the spreadsheet. > Thanks very much for your help. > Anton > ps one more question. when i press the enter key, the cursor moves > down one cell. how do i make the cursor stay on the same cell so i can > enter a series of grocery expenses without moving the cursor up one > cell each time? > > On Jun 24, 9:54 am, Dave Bonallack <davebonall...@hotmail.com> wrote: > > Hi Anton,Attached is a sheet with very simple code. Enter a value into a > > cell in Column B, and you will see the adjacent cell in Col C increase by > > that amount. Since this is done by VBA, there is no formula in the Col C > > cells, so you can make manual corrections there if you want. You should > > note that using this method gives you no record of past entries, since only > > the last entry is retained in Col B cells. Previous entries are constantly > > over-writtenIf you enter non-numeric data into Col B, the macro will fault. > > If this sheet is just for personal use, then it doesn't really matter, but > > we could test for non-numeric input if needed. > > Regards - Dave. > > > > > > > > > > > > > Date: Thu, 24 Jun 2010 03:36:37 -0700 > > > Subject: Re: $$Excel-Macros$$ how to get cumulative sum in a cell > > > From: a...@kwic.com > > > To: excel-macros@googlegroups.com > > > > > Hi Dave, > > > Thanks very much for your reply. Yes this would be sufficient. Your > > > suggestion that XL can monitor changes to A2 and store the cumulative > > > total in A3 would be great. I would have about 50 similar accounts > > > such as gas, books, donations, repairs etc. > > > Would you be able to construct this macro? > > > Best Regards, > > > anton > > > > > On Jun 24, 1:49 am, Dave Bonallack <davebonall...@hotmail.com> wrote: > > > > Hi Anton, > > > > > > XL can almost do what you want, which may be sufficient for you. > > > > > > If you want to be able to enter your grocery expenditure always in the > > > > same cell, XL can accumulate those entries in another cell using VBA. > > > > > > For example, You may enter your grocery expenditure always into A2, but > > > > the actual accumulated total would appear in A3 (or any other cell you > > > > like). This can be done by clicking a button after each entry into A2, > > > > or XL can monitor changes to A2 and do the accumulation automatically. > > > > > > If this suits your purpose, there are lots of us in the group who could > > > > help you achieve this. > > > > > > Regards - Dave. > > > > > > > Date: Wed, 23 Jun 2010 11:22:58 -0700 > > > > > Subject: $$Excel-Macros$$ how to get cumulative sum in a cell > > > > > From: a...@kwic.com > > > > > To: excel-macros@googlegroups.com > > > > > > > Dear Group, > > > > > I am constructing a single entry accounting spreadsheet in excel. i > > > > > would like to input numbers for, say grocery expenses, in a cell of > > > > > fixed location. when I buy more groceries i would like to type in the > > > > > new expense in the same cell so that the output of that cell is the > > > > > cumulative total expenses for groceries. > > > > > any way to do this in excel? > > > > > Thanks for reading, > > > > > anton > > > > > > > -- > > > > > ---------------------------------------------------------------------------------- > > > > > Some important links for excel users: > > > > > 1. Follow us on TWITTER for tips tricks and links > > > > > :http://twitter.com/exceldailytip > > > > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > > > > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > > > > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > > > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > > > > > > To post to this group, send email to excel-macros@googlegroups.com > > > > > > > <><><><><><><><><><><><><><><><><><><><><><> > > > > > HELP US GROW !! > > > > > > > We reach over 7000 subscribers worldwide and receive many nice notes > > > > > about the learning and support from the group.Let friends and > > > > > co-workers know they can subscribe to group > > > > > athttp://groups.google.com/group/excel-macros/subscribe > > > > > > _________________________________________________________________ > > > > Need a new place to live? Find it on > > > > Domain.com.auhttp://clk.atdmt.com/NMN/go/157631292/direct/01/-Hide > > > > quoted text - > > > > > > - Show quoted text - > > > > > -- > > > ---------------------------------------------------------------------------------- > > > Some important links for excel users: > > > 1. Follow us on TWITTER for tips tricks and links > > > :http://twitter.com/exceldailytip > > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > > > > To post to this group, send email to excel-macros@googlegroups.com > > > > > <><><><><><><><><><><><><><><><><><><><><><> > > > HELP US GROW !! > > > > > We reach over 7000 subscribers worldwide and receive many nice notes > > > about the learning and support from the group.Let friends and co-workers > > > know they can subscribe to group > > > athttp://groups.google.com/group/excel-macros/subscribe > > > > _________________________________________________________________ > > Browse profiles for FREE! Meet local singles > > online.http://clk.atdmt.com/NMN/go/150855801/direct/01/ > > > > Groceries.xls > > 38KViewDownload- Hide quoted text - > > > > - Show quoted text - > > -- > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 7000 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe _________________________________________________________________ New, Used, Demo, Dealer or Private? Find it at CarPoint.com.au http://clk.atdmt.com/NMN/go/206222968/direct/01/ -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 7000 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe