Goto last filtered row

Av8tordude

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

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,526
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
56,526
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,482
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
969
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
56,526
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,129,486
Messages
5,636,614
Members
416,929
Latest member
Nitil

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