Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Charts should not be resized when deleting rows/columns. | Charts and Charting in Excel | |||
cell is reinserting a formula in even after deleting it. Why | Excel Discussion (Misc queries) | |||
delete values in several cells without deleting the formulas | Excel Discussion (Misc queries) | |||
After deleting a macro, I still get the pop-up when opening file | Excel Worksheet Functions | |||
Deleting Zero after Subtotal | Excel Worksheet Functions |