select last visible cell in autofilter

keithkemble

Board Regular
Joined
Feb 15, 2002
Messages
160
HI Folks,

I have having difficulty in determining how to find the last visible cell in a filtered selection and would appreciate any pointers

(Objective - select visible range - to select first visible cell column A to last visible cell column k then clear contents) having already filtered for 3 criteria (first data row 13)

The selection must only be visible cells. and would use the the clearcontents command for the range as there is data to the right of column K.

I currently have a macro that asks for 3 lots of criteria for the autofilter
Then filters leaving the visible cells

Then finds the first visible cell - which is stored to a variable

Unable then to determine / find / locate (via VBA) the last visible cell/ row (endup etc does not find the visible only the last physical cell/row)

thanks
 
cheers Rick,

I will experiment with the functions later once I have finished embellshing my current routine
Thanks
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Does this do it?:
Code:
Set zzz = ActiveSheet.AutoFilter.Range
zzz.Offset(1).Resize(zzz.Rows.Count - 1, 11).SpecialCells(xlCellTypeVisible).Select 'or .clearcontents or .clear
and to cater for no filtered cells remaining:
Code:
Dim yyy As Range
Set zzz = ActiveSheet.AutoFilter.Range
On Error Resume Next
Set yyy = zzz.Offset(1).Resize(zzz.Rows.Count - 1, 11).SpecialCells(xlCellTypeVisible)    '.Select 'or .clearcontents or .clear
On Error GoTo 0
If Not yyy Is Nothing Then yyy.Select    'or .clearcontents or .clear
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,749
Members
452,940
Latest member
rootytrip

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