View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
carlo carlo is offline
external usenet poster
 
Posts: 367
Default How can I delete duplicated data

You can use this code in VBA:
'---------------------------------------------------
Sub DeleteRows()

Dim ws As Worksheet

Set ws = Worksheets("sheet2")

For i = ws.Cells(65536, 1).End(xlUp).Row To 2 Step -1
If IsDate(ws.Cells(i, 4)) And IsDate(ws.Cells(i, 3)) Then
If ws.Cells(i, 4) - ws.Cells(i, 3) < 1.38888888614019E-03 Then
Debug.Print i & ":"; ws.Cells(i, 4) - ws.Cells(i, 3)
Rows(i).Interior.ColorIndex = 3
End If
End If
Next i

End Sub
'---------------------------------------------------

hth

Carlo

On Dec 20, 5:29 am, tweacle
wrote:
I have a workbook and I need to delete certain data. What it is if the
time difference in columns C and D is less than 2 mins I need that row
deleted and cells shifted up. It will always be in columns C and D and
will be numerous rows. Has anyone any idea as to how I can do this.
Dosent matter if it works up or down the workbook.

I.E if C and D 14 time diff is less than 2 mins I need that row deleted
and cells shifted up.

Can anyone help.

Thanks

--
tweacle