This can be easily be accomplished via Pivot table.
Main Topics
Browse All TopicsAll
I am endeavouring to 'write' (and not succeeding to well) a macro to:
begin at AE3, find next blank cell and autosum, then find next blank cell and autosum until last row of data
This is an addition to removing duplicate rows that you guys helped with.
The initial duplicate row removal works a treat however some staff have two records for salary and so I can have a single record per employee I need to total the salary (column ae) and only have one record AND to add even more complexity I would lilke the sum figure placed in the row immediately above and then delete the row above that
This is probably as clear as mud so please see the attached example
rgds and TIA
Shaz0503
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm not sure of the exact purpose of this snippet of the code, but I created it as close to your specifications as possible. If part of it is not right, let me know if you need me to edit it for you.
One thing that I used judgment on is if there are consecutive blanks, I have it not adding the autosum there.
all
I would lilke code to include within a macro.
Basically I have a spreadhseet that contains in excess of 2000 rows and 55 columns of HR data - on completion of data formatting etc i have approx 700 rows and 30 columns of data/information
There are duplicate records where an employee works in differing areas of the buisness or may work part and also as a casual. In these instances there would be two active records, However most staff only have one active record (but may have several inactive records in the system) and based some code from chris
http://www.experts-exchang
I have been able to 'remove' all duplicates with the exception of staff who have two active positions. (there are only 7 this month)
I need to be able to total their salary from both positions in the blank row and then copy the total into the second record and delete the first one (all information contained in reords that is required for my report is the same within each record - only differences are the salary and record number (rec # not needed)
I can run the macro to this stage and then manually complete the sum, cut paste and delete row but would prefer to include code and then continue with the remainder of the macro
I did try a pivot but doesn't do what I need - but thanks
I will try your code carmalize
rgds
Shaz
carmalize
I have included some of your code - thank you - and works fine except that the first caluclation does not include ae2 and I can't understand why
in this instance i need to sum ae2:ae3 and then ae5:ae6 etc.....
then all i need to do is find the code to remove the first record eg ae2 - i have tried the code
ActiveCell.ClearContents
ActiveCell.Offset(-2, 0).Select
Selection.EntireRow.Delete
but it appears that .clearcontents does not remove the formula and while the row is deleted the result in the remianing row is 0
in addition I need to put in 'correct' the code to find the next blank cell and repeat the above
please see my code thus far
Sub Macrodelete3()
Dim LastRow As Integer
Dim LastBlankRow As Integer
'tell it how many blank rows are at the top
LastBlankRow = 2 '(this would have to change if change the setup of the spreadsheet so that there is a different number of blank rows at the top)
'set last row
Range("A1").Select
LastRow = Cells(500, 1).End(xlUp).Row
Range("AE3").Select
Do While ActiveCell.Row <= LastRow
If ActiveCell.Value = "" Then
ActiveCell.Formula = "=SUM(R[" & LastBlankRow + 1 - ActiveCell.Row & "]C:R[-1]C)"
ActiveCell.Copy
ActiveCell.Offset(-1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(1, 0).Select
ActiveCell.ClearContents
ActiveCell.Offset(-2, 0).Select
Selection.EntireRow.Delete
LastBlankRow = ActiveCell.Row
If ActiveCell.Value = 0 Then
ActiveCell.Value = ""
End If
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("A1").Select
End Sub
Business Accounts
Answer for Membership
by: mcleevesPosted on 2009-10-01 at 02:38:21ID: 25467073
I am assuming you want your sum to appear in the blank row below the groups in column AE. If so, this is how you write the macro:
That will get your Auto Sum. I have two questions: