LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Setting up and Configuration of Excel 1 November 12th 08 06:05 PM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Help!!! I have problem deleting 2500 rows of filtered rows shirley_kee[_2_] Excel Programming 1 January 12th 06 03:15 AM
deleting hidden rows so i can print only the rows showing?????? jenn Excel Worksheet Functions 0 October 6th 05 04:05 PM


All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"