Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
How do I find a value (or values) in a range (column) and delte it /them when
found All suggestions appreciated -- Neil |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
Do you want to identify the duplicate values, give us some example
"Neil" wrote: How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
Data = 345 Set found = Columns("A").Find(what:=Data, LookIn:=xlValues, lookat:=xlWhole) If Not found Is Nothing Then found.Delete shift:=xlShiftUp End If "Neil" wrote: How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
Sub findanddelete()
mc = "a" For i = Cells(rows.Count, mc).End(xlUp).Row To 1 Step -1 If Cells(i, mc) = 3 Then rows(i).Delete Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Neil" wrote in message ... How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
Not as eloquent as some others, but this should get the job done:
Sub DeleteDuplicateRows() ' ' This macro deletes duplicate rows in the selection. Duplicates are ' counted in the COLUMN of the active cell. Dim Col As Integer Dim r As Long Dim C As Range Dim n As Long Dim v As Variant Dim rng As Range 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 Regards, Ryan--- -- RyGuy "Don Guillett" wrote: Sub findanddelete() mc = "a" For i = Cells(rows.Count, mc).End(xlUp).Row To 1 Step -1 If Cells(i, mc) = 3 Then rows(i).Delete Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Neil" wrote in message ... How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
great thanks for the quick response
-- Neil "ryguy7272" wrote: Not as eloquent as some others, but this should get the job done: Sub DeleteDuplicateRows() ' ' This macro deletes duplicate rows in the selection. Duplicates are ' counted in the COLUMN of the active cell. Dim Col As Integer Dim r As Long Dim C As Range Dim n As Long Dim v As Variant Dim rng As Range 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 Regards, Ryan--- -- RyGuy "Don Guillett" wrote: Sub findanddelete() mc = "a" For i = Cells(rows.Count, mc).End(xlUp).Row To 1 Step -1 If Cells(i, mc) = 3 Then rows(i).Delete Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Neil" wrote in message ... How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
thanks for the quick reply Don
-- Neil "Don Guillett" wrote: Sub findanddelete() mc = "a" For i = Cells(rows.Count, mc).End(xlUp).Row To 1 Step -1 If Cells(i, mc) = 3 Then rows(i).Delete Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "Neil" wrote in message ... How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
Great thanks for the quick reply Joel
-- Neil "Joel" wrote: Data = 345 Set found = Columns("A").Find(what:=Data, LookIn:=xlValues, lookat:=xlWhole) If Not found Is Nothing Then found.Delete shift:=xlShiftUp End If "Neil" wrote: How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
thanks for the quick reply Ranjit - I have used the ideas from the other guys
-- Neil "Ranjit kurian" wrote: Do you want to identify the duplicate values, give us some example "Neil" wrote: How do I find a value (or values) in a range (column) and delte it /them when found All suggestions appreciated -- Neil |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |