ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy last row without header (https://www.excelbanter.com/excel-programming/322385-copy-last-row-without-header.html)

JH

copy last row without header
 
Hello again

I'm using folowing statements in my macro
the first one copy last row of filtred data and copy it to other sheet
criteria1 are changed in loop

With Sheets(wrkjm & "-9")
Set r = .Range(.Range("B1"), .Range("B" & Rows.Count).End(xlUp))
r.AutoFilter field:=2, Criteria1:=vyr
r.AutoFilter field:=4, Criteria1:=zav
Set r = r.SpecialCells(xlCellTypeLastCell).EntireRow
End With
r.Copy Sheets(wrkjm).Range("A" & radek2)

and the second one
copy filtred range without sheet's header to the other sheet
Set rng = ActiveSheet.AutoFilter.Range
If rng.Columns(1).SpecialCells(xlVisible).Count 1 Then
rng.Offset(1, 0).Resize(rng.Rows.Count - 1).Copy _
Destination:=Worksheets(wrkjm).Range("A" & lastrow + 1)

I got both on this forum from Tom Ogilvy and work separately well

But I need to "join" them in order to achieve following:
copy last row from the filtred list without copying header to other sheet

Thanks
JH


JH

copy last row without header
 
I'ts ok now
I've already solved it

JH

"JH" wrote:

Hello again

I'm using folowing statements in my macro
the first one copy last row of filtred data and copy it to other sheet
criteria1 are changed in loop

With Sheets(wrkjm & "-9")
Set r = .Range(.Range("B1"), .Range("B" & Rows.Count).End(xlUp))
r.AutoFilter field:=2, Criteria1:=vyr
r.AutoFilter field:=4, Criteria1:=zav
Set r = r.SpecialCells(xlCellTypeLastCell).EntireRow
End With
r.Copy Sheets(wrkjm).Range("A" & radek2)

and the second one
copy filtred range without sheet's header to the other sheet
Set rng = ActiveSheet.AutoFilter.Range
If rng.Columns(1).SpecialCells(xlVisible).Count 1 Then
rng.Offset(1, 0).Resize(rng.Rows.Count - 1).Copy _
Destination:=Worksheets(wrkjm).Range("A" & lastrow + 1)

I got both on this forum from Tom Ogilvy and work separately well

But I need to "join" them in order to achieve following:
copy last row from the filtred list without copying header to other sheet

Thanks
JH



All times are GMT +1. The time now is 02:45 PM.

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