MrExcel Publishing
Your One Stop for Excel Tips & Solutions

will someone please take another look at this


Posted by cw on March 29, 2001 12:17 PM

: I am trying to select the next empty cell after a simple sum function is performed and then continue on with some delete functions I have. You can follow along in the code to see exactly where I am off a bit. **

Does not work because I want to delete ALL cells after my last row with populated cells. I don't want to delete something I just put on the sheet.
something like this:
100
100
sum(a1:a2) 200
DELETE ALL CELLS IN THIS ROW AND BELOW.


Posted by Dave Hawley on March 29, 2001 6:12 PM

**


CJ, your statement "I want to delete ALL cells after my last row with populated cells" confuses me. All cells after your LAST row will already be blank, that is why it is the LAST cell.

Anyway, give this a go.

Sub TyThis()
Dim SumCell As Range
Set SumCell = Range("A1").End(xlDown).Offset(1, 0)
SumCell = "=Sum(A1:" & SumCell.Offset(-1, 0).Address & ")"
Range(SumCell.Offset(1, 0), "A65536").Clear
End Sub

DaveOzGrid Business Applications