ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find last real row of filterred data table (https://www.excelbanter.com/excel-programming/304831-find-last-real-row-filterred-data-table.html)

andibevan

Find last real row of filterred data table
 
Hi all,

I am using the the following code to copy data to the bottom of a dat
table:-

Worksheets("Dialog11").Range("A2:AA2").Copy _
Destination:=Worksheets("Project Log Form").Cells(Rows.Count
1).End(xlUp)(2)

Problem is that this code works fine when the autofilters are no
applied but if a filter is set the code copies the data to the las
visible row.

Does anyone have any clues on how to add the data to the real las
row.

If it makes life easier, each data entry has a unique ID in column
and the highest ID number is always located in the last real row.

Any help would be greatfully received.

Ta

And

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Find last real row of filterred data table
 
Dim rng as Range
With Worksheets("Project Log Form)
if .AutofilterMode and .FilterMode then
set rng = .Autofilter.Range
set rng = rng.offset(rng.rows.count,0).Resize(1,1)
set rng = .cells(rng.row,1)
else
set rng = .Cells(rows.count,1).End(xlup)
End if
End With
Worksheets("Dialog11").Range("A2"AA2").copy _
Destination:=rng

--
Regards,
Tom Ogilvy

"andibevan " wrote in message
...
Hi all,

I am using the the following code to copy data to the bottom of a data
table:-

Worksheets("Dialog11").Range("A2:AA2").Copy _
Destination:=Worksheets("Project Log Form").Cells(Rows.Count,
1).End(xlUp)(2)

Problem is that this code works fine when the autofilters are not
applied but if a filter is set the code copies the data to the last
visible row.

Does anyone have any clues on how to add the data to the real last
row.

If it makes life easier, each data entry has a unique ID in column B
and the highest ID number is always located in the last real row.

Any help would be greatfully received.

Ta

Andi


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:34 AM.

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