Goto last filtered row

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
955
After auto-filtering my data, I would like to select (goto) the last filtered row. how can I do this in VBA
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,529
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
   Application.Goto Range("A" & Rows.Count).End(xlUp)
 
Solution

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,529
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
48,400
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

In case ...
  • there is other data below the AutoFilter range or
  • columns are inserted so that column A is no longer part of the AutoFilter range or
  • the bottom visible cell(s) in column A of the AutoFilter range is/are blank
.. then this might be more robust.

VBA Code:
Sub LastFltrRow()
  With ActiveSheet.AutoFilter.Range.SpecialCells(xlVisible)
    With .Areas(.Areas.Count)
      .Rows(.Rows.Count).Select
    End With
  End With
End Sub
 

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
955
In conjunction to going to the last row, how can I put a line under the selected row. I tried this, but it places a line under every row. I just want a line under the last filtered row.

VBA Code:
Range("A7:S" & lRow).LineStyle = xlContinuous
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,529
Office Version
  1. 365
Platform
  1. Windows
With Peter's code just replace Select with
VBA Code:
Borders(xlBottom).LineStyle = xlContinuous
 

Watch MrExcel Video

Forum statistics

Threads
1,127,554
Messages
5,625,477
Members
416,109
Latest member
TripleA00123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top