Find last real row of filterred data table

  • Thread starter Thread starter andibevan
  • Start date Start date
A

andibevan

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top