LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cut, paste and delete


This seems to work:


Code:
--------------------
Sub DeleteDupRow()
'
'
'Deletes row if there is
'a duplicate found in the
'column
'
Dim currentcell As Range
Dim nextcell As Range

Application.ScreenUpdating = False

Sheets.Add 'Adds new worksheet to the left
ActiveSheet.Name = "Duplicates" 'renames new worksheet
ActiveSheet.Next.Select 'moves one worksheet to the right

Set currentcell = ActiveCell

Do While Not IsEmpty(currentcell.Offset(0, 0))
Set nextcell = currentcell.Offset(1, 0)

If nextcell.Value = currentcell.Value Then
currentcell.EntireRow.Copy (Worksheets("Duplicates").Range("A65536").End(xlUp ).Offset(1, 0))
End If

If nextcell.Value = currentcell.Value Then
currentcell.EntireRow.Delete
End If

Set currentcell = nextcell
Loop

Set currentcell = Nothing
Application.ScreenUpdating = True

End Sub
--------------------


Is there any better way of doing this do you think?


--
Daminc
------------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074
View this thread: http://www.excelforum.com/showthread...hreadid=519277

 
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 to cut/paste/delete Betty Csehi Excel Discussion (Misc queries) 3 June 27th 06 02:55 PM
Find, Cut, Paste and Delete rollover99 via OfficeKB.com Excel Worksheet Functions 0 December 29th 05 10:59 PM
Copy, Paste then delete Louise Excel Programming 2 March 22nd 05 03:41 AM
If, Then, Cut, Paste, Delete HELP stephanie spomer Excel Programming 1 September 28th 04 09:51 PM
Protect chartobjects, allow copy paste but NOT CUT (or delete) Gunnar Johansson Excel Programming 0 September 15th 04 09:26 PM


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"