ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy a complete row (https://www.excelbanter.com/excel-programming/433940-copy-complete-row.html)

Fred Smith[_4_]

Copy a complete row
 
I have the following code segment:

Set WorkRange = ...
For Each cell in WorkRange
Taxrow = application.match(cell.value, range("A:A"), 0)
if iserror(taxrow) and cell.offset(0,9) < "Inactive" then

Now I want to copy the entire row that "cell" is on to the active worksheet
row "LastRow".

Is there one or two lines of code that would do this?

Thanks,
Fred


Gary Keramidas

Copy a complete row
 
you can five this a try, but i would qualify the ranges with the sheet names

cell.EntireRow.Copy
Range("A" & lastrow).PasteSpecial xlPasteAll

--


Gary Keramidas
Excel 2003


"Fred Smith" wrote in message
...
I have the following code segment:

Set WorkRange = ...
For Each cell in WorkRange
Taxrow = application.match(cell.value, range("A:A"), 0)
if iserror(taxrow) and cell.offset(0,9) < "Inactive" then

Now I want to copy the entire row that "cell" is on to the active worksheet
row "LastRow".

Is there one or two lines of code that would do this?

Thanks,
Fred



Patrick Molloy[_2_]

Copy a complete row
 
here's an idea:

target = 3
Source = 11

Rows(target).Value = Rows(Source).Value

or

Rows(target).Formula = Rows(Source).Formula

you will of course lose any formatting from the source row
"Fred Smith" wrote:

I have the following code segment:

Set WorkRange = ...
For Each cell in WorkRange
Taxrow = application.match(cell.value, range("A:A"), 0)
if iserror(taxrow) and cell.offset(0,9) < "Inactive" then

Now I want to copy the entire row that "cell" is on to the active worksheet
row "LastRow".

Is there one or two lines of code that would do this?

Thanks,
Fred



Fred Smith[_4_]

Copy a complete row
 
Thanks Gary. Just what I needed.

Fred.

"Gary Keramidas" <GKeramidasAtMSN.com wrote in message
...
you can five this a try, but i would qualify the ranges with the sheet
names

cell.EntireRow.Copy
Range("A" & lastrow).PasteSpecial xlPasteAll

--


Gary Keramidas
Excel 2003


"Fred Smith" wrote in message
...
I have the following code segment:

Set WorkRange = ...
For Each cell in WorkRange
Taxrow = application.match(cell.value, range("A:A"), 0)
if iserror(taxrow) and cell.offset(0,9) < "Inactive" then

Now I want to copy the entire row that "cell" is on to the active
worksheet row "LastRow".

Is there one or two lines of code that would do this?

Thanks,
Fred





All times are GMT +1. The time now is 05:19 PM.

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