ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter question (https://www.excelbanter.com/excel-programming/374798-autofilter-question.html)

MikeG22

Autofilter question
 
I am trying to programatically delete all rows that have been filtered out
with an autofilter in an excel spreadsheet. I can find a lot of examples of
how to delete rows that have not been filtered out, but I want all "hidden"
rows deleted.

Any ideas?

Boo

Autofilter question
 
Mike,

Try this:

For a = 20 To 1 Step -1
If Rows(a).Hidden = True Then
Rows(a).EntireRow.Delete
End If
Next a

Obviosuly it's a small example of the syntax - change the way you scroll
through the rows as you see fit.

"MikeG22" wrote:

I am trying to programatically delete all rows that have been filtered out
with an autofilter in an excel spreadsheet. I can find a lot of examples of
how to delete rows that have not been filtered out, but I want all "hidden"
rows deleted.

Any ideas?


Ron de Bruin

Autofilter question
 
Change the AutoFilter criteria

= criteria to
< criteria

http://www.rondebruin.nl/delete.htm#AutoFilter

then use DeleteValue = "<ron"




--
Regards Ron de Bruin
http://www.rondebruin.nl



"MikeG22" wrote in message ...
I am trying to programatically delete all rows that have been filtered out
with an autofilter in an excel spreadsheet. I can find a lot of examples of
how to delete rows that have not been filtered out, but I want all "hidden"
rows deleted.

Any ideas?




MikeG22

Autofilter question
 
I've tried this and it seems the autofiltered rows are not showing up with
Hidden = true so this won't work... :(

"Boo" wrote:

Mike,

Try this:

For a = 20 To 1 Step -1
If Rows(a).Hidden = True Then
Rows(a).EntireRow.Delete
End If
Next a

Obviosuly it's a small example of the syntax - change the way you scroll
through the rows as you see fit.

"MikeG22" wrote:

I am trying to programatically delete all rows that have been filtered out
with an autofilter in an excel spreadsheet. I can find a lot of examples of
how to delete rows that have not been filtered out, but I want all "hidden"
rows deleted.

Any ideas?


Boo

Autofilter question
 
Mike,

Strange - I tried this before posting and it worked fine...sorry. No other
suggestions :-(

"MikeG22" wrote:

I've tried this and it seems the autofiltered rows are not showing up with
Hidden = true so this won't work... :(

"Boo" wrote:

Mike,

Try this:

For a = 20 To 1 Step -1
If Rows(a).Hidden = True Then
Rows(a).EntireRow.Delete
End If
Next a

Obviosuly it's a small example of the syntax - change the way you scroll
through the rows as you see fit.

"MikeG22" wrote:

I am trying to programatically delete all rows that have been filtered out
with an autofilter in an excel spreadsheet. I can find a lot of examples of
how to delete rows that have not been filtered out, but I want all "hidden"
rows deleted.

Any ideas?


MikeG22

Autofilter question
 
I'm sorry, that does work. Thanks!

"Boo" wrote:

Mike,

Try this:

For a = 20 To 1 Step -1
If Rows(a).Hidden = True Then
Rows(a).EntireRow.Delete
End If
Next a

Obviosuly it's a small example of the syntax - change the way you scroll
through the rows as you see fit.

"MikeG22" wrote:

I am trying to programatically delete all rows that have been filtered out
with an autofilter in an excel spreadsheet. I can find a lot of examples of
how to delete rows that have not been filtered out, but I want all "hidden"
rows deleted.

Any ideas?



All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com