Andri,
Before we continue, let me understand exactly what you want. If yo
encounter a blank cell in column A, you want to remove that row but i
there is a bonus in it (data in column B) you want to add that to th
person above them? Is column B the only column that would have data i
it if the cell in Column A is empty? I know you said it goes all th
way to Column N. If this is the case, you certainly cannot delet
columns A thru H for that row otherwise you lose your bonus data.
Also if there is a possibility that the there is Bonus data and Name
in Column A then you may not start at the bottom. Your currentl
looking for the last non-empty row in column A which in your example i
Row 5. You would never pick up the bonus in Row 6 & 7. So we will loo
in Column B.
Well I'll give it a shot. Since I dont know exactly what you
worksheet looks like, I will set this up for data in the bonus colum
only. If there is more that that, I would store them in an array.
-Sub DeleteEmptyRow()
Dim cRows As Long
Dim i As Long, bonus As Integer, foundBonus As Boolean
cRows = Cells(Rows.Count, "B").End(xlUp).Row
For i = cRows To 1 Step -1
If Cells(i, "A").Value = "" Then
bonus = bonus + Cells(i, "B").Value
foundBonus = True
Range("A" & i, "H" & i).Delete shift:=xlUp
ElseIf Cells(i, "A").Value <> "" And foundBonus = True Then
Cells(i, "B").Value = Cells(i, "B").Value + bonus
bonus = 0
foundBonus = False
End If
Next
End Sub-
Hope this works for you.
Jason
Dear Jason,
Thank you, it works but some there is one problem again...
This is the situation, my big database at the moment
Name Bonus xxxx up to column N...
Row 1 Ann blank cell
Row 2 Blank cell 50
Row 3 Blank cell 100
Row 4 Blank Row
Row 5 Ben Blank Cell
Row 6 Blank cell 30
Row 7 Blank cell 40
Row 8 Blank Row
if we run the module...it information is not clearly to describe tha
Ann
has total bonus 150 (100+50).
Brgds,andr