How To Select First Visible Cell After Applying a Filter

Krucifire

Board Regular
Joined
Nov 8, 2007
Messages
96
Hi Guys,

Running the Following Code which works a Treat But I can Figure out How after I get the Filters to apply how i Select the First Visible Cell

Code:
Worksheets("Trade_List").Select
With Worksheets("Trade_List")
    .AutoFilterMode = False
    Range("C3").Select
    Selection.AutoFilter field:=3, Criteria1:=ComboBox1.Value
    Range("B3").Select
    Selection.AutoFilter field:=2, Criteria1:=ComboBox2.Value
    Range("AL2").Offset(1, 0).Select
    
   
End With

The Table has Two Rows as a Header to the Data so as you can see filters apply. After the Filters apply there will only be 1 row of Data Visible i Want to take the data from within Column "AL" Row "X", Where "X" is the Visible Row and Display it in UserForm1.Textbox1.Text

But i cant remember how to select the Visible row/Cell

any ideas??
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,

You can try this. It's a very cheeky solution and the VBA masters here would frown at it, but it gets the job done.

After you are done filtering, use the code

Code:
        Range("AL2").Select
        ActiveCell.Offset(1, 0).Select
        If Cells(Columns("AL").Rows.Count, "AL").End(xlUp).Row > 3 Then
            Range(Selection, Cells(Columns("AL").Rows.Count, "AL").End(xlUp)).SpecialCells(xlCellTypeVisible).Select
            ActiveCell.Offset(0, 1).Select
            ActiveCell.Offset(0, -1).Select
        End If

Since you said that you had 2 rows with headers, I'm assuming the Row1 and Row2 are the header rows and the data starts from Row3. If not, you can change the >3 part to the row number from which the actual data begins
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
Thanks Mate worked a treat.

You're welcome.

....After the Filters apply there will only be 1 row of Data Visible....

I read this part late. If you have only 1 row of results, then even this will work.

After the filtering code

Code:
Cells(Columns("AL").Rows.Count, "AL").End(xlUp).Select
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Last edited:
Upvote 0
For any number of visible data rows :-

Code:
Range([AL3], Cells(Rows.Count, "AL")).SpecialCells(xlCellTypeVisible)(1).Select

Or the whole code :-

Code:
Worksheets("Trade_List").Select
ActiveSheet.AutoFilterMode = False
[C3].AutoFilter field:=3, Criteria1:=ComboBox1.Value
[B3].AutoFilter field:=2, Criteria1:=ComboBox2.Value
Range([AL3], Cells(Rows.Count, "AL")).SpecialCells(xlCellTypeVisible)(1).Select
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,767
Messages
6,126,767
Members
449,336
Latest member
p17tootie

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