Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

deleting rows messing up sums

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pywhacket - 23 Mar 2006 22:33 GMT
I have a worksheet that uses macros to pull data from other sheets within the
workbook. One of the macros deletes any rows with a zero value after the data
is pulled in - the number of rows varies each time. I need to subtotal and
then total the $$ amount from three sections after the macros have run. The
sum formulas that I have on the sheet get messed up each time. How do I
resolve this?

Thanks!
idyllicabyss@googlemail.com - 24 Mar 2006 01:51 GMT
Are you using absolute references in your formulas eg $A$4 rather than
A4?

If the problem you are having relates to formulas in the row after the
one you delete, as a quick and simple solution you could add this line
after the one that deletes your rows;

cells(activerow,columnwithformulasin).formular1c1 =
cells(activerow-1,columnwithformulasin).formula

where activerow is the row after the one that has been deleted
(presumably the one with error formula) and columnwithformulas in is a
number relating to the columm your totals are in, ,eg column E = 5

Please be more specific with regards your formulas if this is not
relevant.
Cheers.
David McRitchie - 24 Mar 2006 17:19 GMT
Hi ......,

Without the formulas that you are using and an example of what happens
I expect that you are talking about problems with a running balance
being dependent on the previous row  which got deleted or missed
an inserted row in the running balance.    If that is the case you want
to use OFFSET see
   http://www.mvps.org/dmcritchie/excel/offset.htm
   http://www.mvps.org/dmcritchie/excel/insrtrow.htm

This would also apply the the final total,  if you delete the row before
the total or insert a row immediately before the total.
---
HTH,
David McRitchie, Microsoft MVP - Excel    [site changed  Nov. 2001]
My Excel Pages:  http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:        http://www.mvps.org/dmcritchie/excel/search.htm

> I have a worksheet that uses macros to pull data from other sheets within the
> workbook. One of the macros deletes any rows with a zero value after the data
[quoted text clipped - 4 lines]
>
> Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.