View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dudely Dudely is offline
external usenet poster
 
Posts: 21
Default Help Deleting Rows

I've tried this two different ways, neither seems to work quite right.

Set sentWS = ThisWorkbook.Worksheets("Sent")
lastRow = sht.UsedRange.Rows.count 'last row of current sheet
currentRow = sentWS.UsedRange.Rows.count 'last row of sent sheet
currentRow = currentRow + 1
While lastRow 1
Set cell = sht.Range("A" & lastRow)

cell.EntireRow.Copy sentWS.Range("A" & currentRow)

(1) cell.Rows(lastRow).Delete
(2) cell.EntireRow.Delete

currentRow = currentRow + 1
lastRow = lastRow - 1
Wend

The line labeled (1) above fails to do anything at all, and the line
labeled (2) deletes the first line instead of the last line.

The copy works just fine, as does the rest of the code.

So what am I doing wrong please?

Thank you