View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Shaka215@gmail.com is offline
external usenet poster
 
Posts: 162
Default Macro - Cut and paste a row if duplicate

I found this in VB HELP...Maybe you can alter the code to get it to do
what you want...

This example sorts the data in a column of the worksheet specified and
then deletes rows that contain duplicate data.

Sub DeleteColumnDupes(strSheetName As String, strColumnLetter As
String)
Dim strColumnRange As String
Dim rngCurrentCell As Range
Dim rngNextCell As Range

strColumnRange = strColumnLetter & "1"

Worksheets(strSheetName).Range(strColumnRange).Sor t _
Key1:=Worksheets(strSheetName).Range(strColumnRang e)
Set rngCurrentCell = Worksheets(strSheetName).Range(strColumnRange)
Do While Not IsEmpty(rngCurrentCell)
Set rngNextCell = rngCurrentCell.Offset(1, 0)
If rngNextCell.Value = rngCurrentCell.Value Then
rngCurrentCell.EntireRow.Delete
End If
Set rngCurrentCell = rngNextCell
Loop
End Sub

Dileep Chandran wrote:
Sorry, I dont want a program. I just need the code.