![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 91
|
Hi I have some sequence numbers in coulumn A and i want to eliminate duplicate rows from the sheet. How can i do it any suggestions???
Thanks |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
have the un1que entries copied to another column say, column C, then proceed from there. Regards!
__________________
Regards! Yogi Anand, D.Eng, P.E. Energy Efficient Building Network LLC www.energyefficientbuild.com |
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 28
|
try this code:
Sub Edit_EmptyDuplicateCells() On Error GoTo EndMacro If selection.Columns.Count > 1 Then MsgBox "Sorry, you may only select cells in one column.", vbExclamation Exit Sub Else End If If selection.Rows.Count > 1 Then Set rng = selection Else MsgBox "Please select cells in multiple rows.", vbExclamation Exit Sub End If Application.ScreenUpdating = False Application.Calculation = xlCalculationManual i = selection.Cells.Count 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).ClearContents n = n + 1 End If Percentage = n / i * 100 Application.StatusBar = "Now processing: " & Percentage & "%" Next r EndMacro: MsgBox Format(n) & " cells have been cleared.", vbInformation End Sub |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Apr 2002
Location: Vancouver BC , Canada
Posts: 6,259
|
This code will delete dupes until a blank row is found.
Code:
Sub DeleteDups()
Do
RowCnt = RowCnt + 1
RowCnt2 = RowCnt + 1
Do
If Cells(RowCnt, 1).Value = Cells(RowCnt2, 1).Value Then Rows(RowCnt2 & ":" & RowCnt2).Delete Shift:=xlUp
RowCnt2 = RowCnt2 + 1
Loop Until Len(Trim(Cells(RowCnt2, 1).Value)) = 0
Loop Until Len(Trim(Cells(RowCnt, 1).Value)) = 0
End Sub
[ This Message was edited by: nimrod on 2002-05-10 11:17 ] [ This Message was edited by: Nimrod on 2002-05-10 11:19 ] [ This Message was edited by: Nimrod on 2002-05-10 11:23 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|