Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8583659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:35:28+00:00 2026-06-11T21:35:28+00:00

How do you find the last row of data when the data in your

  • 0

How do you find the last row of data when the data in your worksheet is filtered? I have been playing around with Special Cells and Visible Cells but cannot find a solution. I think it must be some kind of variation on what I have below:

    ...
    With ws
        LR = .Range("A" & Rows.Count).End(xlUp).Row
        .Range("A1:E" & LR).AutoFilter Field:=2, Criteria1:="=4"
        LRfilt = .Range("A" & Rows.SpecialCells(xlCellTypeVisible).Count).End(xlUp).Row
        Debug.Print LR
        Debug.Print LRfilt
    End With
    ...

File can be found here:

wikisend.com/download/443370/FindLRFilteredData.xls

Edit:

Realised after discussion with Siddharth I did not want the Last Row property I needed to find a count of the number of visible rows which led on to Sid’s solution below…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:35:29+00:00Added an answer on June 11, 2026 at 9:35 pm

    EDIT: Post Chat Followup

    Option Explicit
    
    Sub FilterTest()
        Dim rRange As Range, fltrdRng As Range, aCell As Range, rngToCopy As Range
        Dim ws As Worksheet
        Dim LR As Long
    
        '~~> Change this to the relevant sheet
        For Each ws In ThisWorkbook.Worksheets
            If Not ws.Name = "Sheet1" Then
                With ws                    
                    '~~> Remove any filters
                    .AutoFilterMode = False
    
                    LR = .Range("A" & Rows.Count).End(xlUp).Row
    
                    '~~> Change this to the relevant range
                    Set rRange = .Range("A1:E" & LR)
    
                    With rRange
                        '~~> Some Filter. Change as applicable
                        .AutoFilter Field:=2, Criteria1:=">10"
    
                        '~~> Get the filtered range
                        Set fltrdRng = .SpecialCells(xlCellTypeVisible)
                    End With
    
                    For Each aCell In fltrdRng
                        If aCell.Column = 1 Then
                            If rngToCopy Is Nothing Then
                                Set rngToCopy = aCell
                            Else
                                Set rngToCopy = Union(rngToCopy, aCell)
                            End If
                        End If
                    Next
    
                    Debug.Print ws.Name
                    Debug.Print rngToCopy.Address
    
                    'rngToCopy.Copy
    
                    Set rngToCopy = Nothing
    
                    '~~> Remove any filters
                    .AutoFilterMode = False
                End With
            End If
        Next
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I find the last row that contains data in a specific column
All, How can I find the last row in an excelsheet with data populated
I am writing a shell script in which I have to find the last
i have a string %/O^/O%/O . I want to find the last / to
I have an unordered list, and am using jquery to find the last ul
I would like to find the last row of the datagridview and i would
I've been trying out various ways of finding the last row in a range
I'm making a table with data, and the last column needs to be have
I've been all over the place for the last two days trying to find
I have an m x n Matrix, which I call data. The last column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.