LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Deleting rows based on data NOT meeting criteria --working macro here, just need help with tweaking

Here is the model of the code I'm using -- this come from
http://www.rondebruin.nl/delete.htm

Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1

With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1

If IsError(.Cells(Lrow, "A").Value) Then
'Do nothing, This avoid a error if there is a error in
the cell

ElseIf .Cells(Lrow, "A").Value = "ron"
Then .Rows(Lrow).Delete
'This will delete each row with the Value "ron" in
Column A, case sensitive.

End If
Next
End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub

__________________________________________________ __

Here is my situation and my questions:

In Column A on my spreadsheet, there is data like this:


AR3303
AR4055
Subtotal
Blank Cell (and row)
Blank Cell (and row)
AR9999
DP3838
DP3923
DP3932


What I want to do is delete all rows that do NOT contain the DP in the
first cell (Column A cell). I think I could do this somehow using a
LEFT function and obviously an IF NOT function somehow, but I'm having
problems tweaking it to do it this way.

Can anybody help?

 
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
Deleting rows meeting certain criteria in a particular column tsraj Excel Discussion (Misc queries) 1 April 1st 10 07:58 PM
Deleting entire rows based on certain criteria Nan[_4_] Excel Programming 1 July 12th 04 05:04 PM
Deleting rows based on multiple criteria Sandip Shah Excel Programming 3 July 12th 04 01:57 PM
Deleting rows based on cell criteria jgranda Excel Programming 1 April 27th 04 06:41 PM
Deleting rows based on criteria John Walker[_2_] Excel Programming 2 December 12th 03 08:37 PM


All times are GMT +1. The time now is 07:40 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"