Selecting Cell in a Filtered Spreadsheet

LDale

New Member
Joined
Apr 2, 2011
Messages
26
How can I select in column A the first visible cell in thecolumn in a filtered table. Need someVBA code that will take me to the cell of the first visible row. If the first visible row is row 5 I want toselect A5. If first visible row is row12 I want to select A12. If first visible row is


 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
How can I select in column A the first visible cell in thecolumn in a filtered table. Need someVBA code that will take me to the cell of the first visible row. If the first visible row is row 5 I want toselect A5. If first visible row is row12 I want to select A12. If first visible row is


The first visible cell in column A of the filetered range will be the cell in column A of the first row of the range. i.e. If you filter range Z40:AN300 then cell A40 would be your first visible cell, assuming you have data across columns A:AN. If you want the first visible cell on the worksheet in column A, then That would be the row where your headers or data begin. If you try to use the SpecialCells method in VBA to locate the first cell, it will probably give you the firts visble cell on the sheet in column A, unless you specify the Range that was filtered.
 
Upvote 0
I will re-phrase my comments. For me to know how to write the code to assist you, I need to know something about how your data is distributed on the worksheet, with respect to the filtered range. e.g. Data may be A1:ZZZ15000, but the filtered table is in BB20:BL200. Then the part of the table that is filtered is BC20:BL100. So The code would need to point to Range("BC20") because that will be the first visible cell of the filtered range.
 
Upvote 0
My goal is to get to the first visible cell under A1 no matter how many filters are applied and no matter how many columns there are in the spreadsheet.
 
Upvote 0
My goal is to get to the first visible cell under A1 no matter how many filters are applied and no matter how many columns there are in the spreadsheet.

]
In that case.
Code:
Sub vixCell()
Dim c As Range
For Each c In ActiveSheet.Range("A1", Cells(Rows.Count, 1).End(xlUp))
    If c.EntireRow.Hidden = False Then
        MsgBox "First Visible Cells Is " & c.Address
        Exit Sub
    End If
Next
End Sub
 
Upvote 0
Thank you so very much. I just changed the A1 to A2 and it worked perfect. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,948
Messages
6,127,871
Members
449,410
Latest member
adunn_23

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