#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Macro

How do I find a value (or values) in a range (column) and delte it /them when
found

All suggestions appreciated
--
Neil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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
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 recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 08:57 PM.

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"