I have a large MS Word 2003 table of data.
However, after sorting the table I noticed that I have a lot of duplicate
rows of data.
I'm looking for ways to delete the extra/duplicate rows of data other than
manually having to select and delete the rows a few at a time.
I want to make sure I keep one original row of data and just delete the
extra ones.
Any solutions.
Note: If only "coded" solutions are available, I'm only able to cut & past
code...but not write it myself.
Thanks to any and all who can and will help.
Bye,
JV
For a solution without a macro, see
http://word.mvps.org/FAQs/General/UsingWildcards.htm
A macro solution is easier, once you have put the macro in your normal.dot.
If you need help with that, see
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
The macro below will delete duplicate rows. It only looks at the text... If
two rows have the same text, but are formatted differently, the second one
is still deleted.
Regards,
Klaus
Sub DeleteDuplicateRows()
' deletes duplicate rows in the table the cursor is in
Dim tableLoop As Table
Dim rowLoop As Row
Dim strRowOld As String
Dim strRowNew As String
If Selection.Information(wdWithInTable) = False Then
MsgBox "Selection is not in a table", vbCritical, _
"Macro can't run"
Exit Sub
End If
Set tableLoop = Selection.Tables(1)
For Each rowLoop In tableLoop.Rows
strRowNew = rowLoop.Range.Text
If rowLoop.Index > 1 Then
If strRowNew = strRowOld Then
rowLoop.Delete
End If
End If
strRowOld = strRowNew
Next rowLoop
End Sub
Mega-thanks for the code solution. You made my day.
FYI: I successfully added the macro to normal.dot, assigned the macro to a
new toolbar button, and ran it on the "duplicate filled table.
Now I have a cleaned up table with no "dupes"
You "code" people are amazing!
Thanks!
-JV
============================
"Klaus Linke" <in...@fotosatz-kaufmann.de.no.junk> wrote in message
news:OGZiML6Q...@tk2msftngp13.phx.gbl...