ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shift a cut row up (https://www.excelbanter.com/excel-programming/431601-re-shift-cut-row-up.html)

Patrick Molloy

Shift a cut row up
 
try this as an alternative:

Sheets("Database").Rows(iSourceRow).Copy
Sheets("archive").Rows(iTgtRow).PasteSpecial xlValues
Sheets("Database").Rows(iSourceRow).Delete

"Risky Dave" wrote in message
...
Hi,

I have some code that cuts a row from one sheet (Database) and pastes it
into another one (Archive):

Dim iSourceRow As Integer
Dim iTgtRow As Integer

Sheets("Database").Range(iSourceRow & ":" & iSourceRow).cut_
Destination:=Sheets("archive").Range(iTgtRow & ":" & iTgtRow)

This works fine except that I cannot get the Database sheet to shift up
all
teh rows below the one that is cut (so that all the data rows are
contiguous). I have tried adding

Shift:= xlUp to the line above, but this generates an "Expected: end of
statement" error

Suggestions on how I can get the rows to move up woould be welcome.

TIA

Dave




All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com