Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Check if filtered cells contain data to delete

Hi all, I need a bit of help with code for the following. I am filtering
a column for certain criteria and i need to check if the other cells in
the filtered visual cells contain data, if no data continue with code
else delete rows visable only.

Selection.AutoFilter Field:=9, Criteria1:="=*za-t-m-**", Operator:=xlAnd


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Check if filtered cells contain data to delete

With Worksheets("sheet1")
If .AutoFilter.Range.Columns(1).Cells.SpecialCells(xl CellTypeVisible) _
.Count = 1 Then
'Only headers
MsgBox "nothing to delete"
Else
With .AutoFilter.Range
.Resize(.Rows.Count - 1).Offset(1, 0).EntireRow.Delete
End With
End If
End With


Les Stout wrote:

Hi all, I need a bit of help with code for the following. I am filtering
a column for certain criteria and i need to check if the other cells in
the filtered visual cells contain data, if no data continue with code
else delete rows visable only.

Selection.AutoFilter Field:=9, Criteria1:="=*za-t-m-**", Operator:=xlAnd

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Check if filtered cells contain data to delete

Thanks a lot Dave,

I will give it a bash in the morning and let you know..

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Check if filtered cells contain data to delete

Thank you Dave Peterson, your solution worked 100%, thanks.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling cells with filtered data to another sheet. Brian Ness New Users to Excel 2 December 9th 09 12:23 AM
paste data over hidden cells that are filtered derwood[_2_] Excel Worksheet Functions 1 March 9th 08 02:11 AM
Copy visible cells on Filtered data [email protected] Excel Discussion (Misc queries) 4 July 18th 07 08:18 AM
How do I only delete/clear the visible cells in a filtered list? Merv Excel Worksheet Functions 5 March 2nd 07 07:00 PM
Macro To Delete Filtered Pivot Table Data Roger[_21_] Excel Programming 0 June 1st 06 04:58 PM


All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"