Get value from autofiltered sheet using VBA

sipron

New Member
Joined
Aug 6, 2010
Messages
9
Hi
I have 4 columns which are all filtered through a macro. When filtered there will only be one row left except for the header. I would like to get the value of cell(2,4) when the filters are active. My problem is that i get the value from cell(2,4) when it's unfiltered.

Does anyone know a solution to this?

/John
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

DauntingGecko

Well-known Member
Joined
Feb 2, 2006
Messages
521
Code:
Sub myExample()
Dim i As Double

    i = 2
    Do While Rows(i).Hidden = True
        i = i + 1
    Loop
    
    MsgBox Cells(i, 4)

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,531
Messages
5,602,202
Members
414,513
Latest member
junbuggle

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