Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help with Filter and Delete...... Please

Hi all, i have many rows with the same number in column A and i am
filtering column F for the criteria "ZA-T-M-*" which is working fine.
However i need somehow to delete all rows with the same number in column
A. The second last row has ZA-T-M-* in it so all rows with instances of
"A15862" in column "A" muist be deleted. Can someone please help. Thank
you in advance...

A B C D E F
A15862 Creation K5210 7118410 UPHOLSTERY EI-
A15862 Creation K5210 7118410 UPHOLSTERY E-M
A15862 Creation K5210 7139700 UPHOLSTERY EI-A15862 Creation
K5210 7139700 UPHOLSTERY FZ-A15862 Creation
L2
A15862 Creation TI-
A15862 Creation ZA-T-M-1
A15862 Creation


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default Help with Filter and Delete...... Please

Les

Apply a second filter to column A for whatever number you wish to
delete and then delete them.

When I do something like this, I usually set two range objects - one
for the autofilter range, and one for the data range (ie the same less
header row), and then use SpecialCells method to delete only the
visible cells. In xl2002 and 2003 you don't have to worry about using
the SpecialMethod, but it does make your code absolutely clear what you
are doing (and intending to do). Something like:

With rng
.Autofilter Field:=1, Criteria1:=<Your Number Here
rng2.SpecialCells(xlCellTypeVisible).EntireRow.Del ete
End With

Does this give you enough detail to work up a solution?

Best regards

Richard


Les Stout wrote:

Hi all, i have many rows with the same number in column A and i am
filtering column F for the criteria "ZA-T-M-*" which is working fine.
However i need somehow to delete all rows with the same number in column
A. The second last row has ZA-T-M-* in it so all rows with instances of
"A15862" in column "A" muist be deleted. Can someone please help. Thank
you in advance...

A B C D E F
A15862 Creation K5210 7118410 UPHOLSTERY EI-
A15862 Creation K5210 7118410 UPHOLSTERY E-M
A15862 Creation K5210 7139700 UPHOLSTERY EI-A15862 Creation
K5210 7139700 UPHOLSTERY FZ-A15862 Creation
L2
A15862 Creation TI-
A15862 Creation ZA-T-M-1
A15862 Creation


Les Stout

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help with Filter and Delete...... Please

Hi Richard,

Yes i think so thanks for your input...

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help with Filter and Delete...... Please

Hi, i have the following code which works great, i just do not know how
to delete all instances of the number in column "A". Should i copy and
save the filtered out numbers and then delete all instances using
vlookup ?

Sub FilterAndErase()
'
'
Application.ScreenUpdating = False
'
Rows("1:19").Delete Shift:=xlUp
Rows("1:1").AutoFilter

'************ Filter the field gAMS Created by ****************

Dim Rng As Range
Dim i As Long
Dim myArr As Variant
Dim myRows As Long
myRows = Cells(Application.Rows.Count, 1).End(xlUp).Row
myArr = Array("=*za-t-m-**")
For i = LBound(myArr) To UBound(myArr)

ActiveSheet.Range("A1:P" & myRows).AutoFilter Field:=8,
Criteria1:=myArr(i)
With ActiveSheet.AutoFilter.Range
Set Rng = Nothing
On Error Resume Next
Set Rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not Rng Is Nothing Then Rng.EntireRow.Delete
End With
Next i
ActiveSheet.AutoFilterMode = False

End sub

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Help with Filter and Delete...... Please

Are you wanting to delete rows with ("=*za-t-m-**") in them? Or keep this
row and delete all others with the same numer in A?

Mike F
"Les Stout" wrote in message
...
Hi, i have the following code which works great, i just do not know how
to delete all instances of the number in column "A". Should i copy and
save the filtered out numbers and then delete all instances using
vlookup ?

Sub FilterAndErase()
'
'
Application.ScreenUpdating = False
'
Rows("1:19").Delete Shift:=xlUp
Rows("1:1").AutoFilter

'************ Filter the field gAMS Created by ****************

Dim Rng As Range
Dim i As Long
Dim myArr As Variant
Dim myRows As Long
myRows = Cells(Application.Rows.Count, 1).End(xlUp).Row
myArr = Array("=*za-t-m-**")
For i = LBound(myArr) To UBound(myArr)

ActiveSheet.Range("A1:P" & myRows).AutoFilter Field:=8,
Criteria1:=myArr(i)
With ActiveSheet.AutoFilter.Range
Set Rng = Nothing
On Error Resume Next
Set Rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not Rng Is Nothing Then Rng.EntireRow.Delete
End With
Next i
ActiveSheet.AutoFilterMode = False

End sub

Les Stout

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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help with Filter and Delete...... Please

Hi Mike, I filter for ("=*za-t-m-**") and want to delete the row, which
i am managing with the code.. My problem is however that i have to
delete all of the rows with the same number for this row in column "A"
which is anything from 1 to 50 rows.



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
filter and delete AND Excel Discussion (Misc queries) 3 March 16th 09 04:27 PM
Filter and Delete lotivbarjoh Excel Worksheet Functions 6 June 30th 08 06:57 PM
AFTER 8 SEC ON SPACEBAR I GOT A FILTER?DELETE IT? Carl Excel Discussion (Misc queries) 2 June 16th 07 02:05 PM
Filter list and delete OfficeNDN Excel Discussion (Misc queries) 4 September 11th 06 04:08 PM
filter and delete Jordan Excel Worksheet Functions 1 July 7th 05 07:18 PM


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

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

About Us

"It's about Microsoft Excel"