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 needed with find & Delete

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 you please help with some
code please. Thank you in advance...

A B C D E F
A15862 Creation K5210 7118410 UPHOLSTERY Donner/EI-
A15862 Creation K5210 7118410 UPHOLSTERY Jakob/L2A
A15862 Creation K5210 7139700 UPHOLSTERY Wilhelm/EI-A15862 Creation
K5210 7139700 UPHOLSTERY Gutowski/FZ-A15862 Creation Weber/L2-U
A15862 Creation Archut/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: 396
Default Help needed with find & Delete

Further to my last post is the code that i am using...
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

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Help needed with find & Delete

Change myArr = Array("*za-t-m-**") to myArr = Array("<*za-t-m-**"). Your
range to delete is refering to Visible Cells, so make what you want to get
rid of visible in the AutoFilter.


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:=6, 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

Mike F
"Les Stout" wrote in message
...
Further to my last post is the code that i am using...
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

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
Macro needed to delete rows simmerdown Excel Programming 4 March 27th 06 04:00 PM
How to delete a web query when it's no longer needed? David Excel Programming 3 February 7th 06 05:27 AM
find and delete duplicate entries in two columns or find and prin. campare 2 columns of numbers-find unique Excel Programming 1 November 24th 04 04:09 PM
find and delete text, find a 10-digit number and put it in a textbox Paul Excel Programming 3 November 16th 04 04:21 PM
delete code needed Rick Excel Programming 2 September 21st 04 07:39 PM


All times are GMT +1. The time now is 11:48 PM.

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"