Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
PCOR
 
Posts: n/a
Default deleting 4's(four)

Dim Col As Integer
Dim r As Long
Dim c As Range
Dim N As Long
Dim V As Variant
Dim Rng As Range

Hi
I have been using this macro to delete DUplicate in an Excel sheet.
How can I modify it to delete any line where a given col contains a 4(four)
or any other given number?

Thanks
Ian M

On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Col = ActiveCell.Column

If Selection.Rows.Count 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If

N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, 1).Value
If Application.WorksheetFunction.CountIf(Rng.Columns( 1), V) 1 Then
Rng.Rows(r).EntireRow.Delete
N = N + 1
End If
Next r

EndMacro:

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic






End Sub


--
Norton Professional 2004 says this email is clean...believe it


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
Charts should not be resized when deleting rows/columns. BobM Charts and Charting in Excel 1 February 11th 05 07:39 AM
cell is reinserting a formula in even after deleting it. Why Michele Dickinson Excel Discussion (Misc queries) 5 February 8th 05 03:31 PM
delete values in several cells without deleting the formulas dranreb Excel Discussion (Misc queries) 4 December 9th 04 01:15 AM
After deleting a macro, I still get the pop-up when opening file Anne Excel Worksheet Functions 2 December 8th 04 05:31 PM
Deleting Zero after Subtotal Amber M Excel Worksheet Functions 4 November 1st 04 02:01 AM


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