Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 05-04-2015, 11:05 AM
iSlam Khaled iSlam Khaled is offline how to check for duplicated words / cells ? Windows 8 how to check for duplicated words / cells ? Office 2013
Novice
how to check for duplicated words / cells ?
 
Join Date: May 2015
Posts: 7
iSlam Khaled is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
There is no simple alternative while you use Word, but you can automate it with a macro that performs the steps e.g.

Code:
Sub CheckDuplicates()
Dim oTable As Table
Dim oCell1 As Range, oCell2 As Range
Dim i As Long
    If Not Selection.Information(wdWithInTable) Then
        Beep
        MsgBox "The cursor is not in a table?"
        GoTo lbl_Exit
    End If
    Set oTable = Selection.Tables(1)
    oTable.Sort ExcludeHeader:=False, FieldNumber:="Column 2", _
                SortFieldType:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending
    DoEvents
    For i = 2 To oTable.Rows.Count - 1
        Set oCell1 = oTable.Rows(i).Cells(2).Range
        oCell1.End = oCell1.End - 1
        Set oCell2 = oTable.Rows(i + 1).Cells(2).Range
        oCell2.End = oCell2.End - 1
        If oCell1.Text = oCell2.Text Then
            oCell1.HighlightColorIndex = wdYellow
            oCell2.HighlightColorIndex = wdYellow
        End If
    Next i
    oTable.Sort ExcludeHeader:=False, FieldNumber:="Column 1", _
                SortFieldType:=wdSortFieldNumeric, SortOrder:=wdSortOrderAscending
lbl_Exit:
    Set oTable = Nothing
    Set oCell1 = Nothing
    Set oCell2 = Nothing
    Exit Sub
End Sub
Thanks alot for help .
But how can i use this ?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to check for duplicated words / cells ? Adding words to spell check dictionary oakwoodbank Word 17 02-27-2015 08:09 PM
how to check for duplicated words / cells ? Check for duplicated data and print list cjharley Excel 2 12-19-2014 11:44 PM
Words are being duplicated in text boxes argentraven PowerPoint 0 07-24-2014 03:10 PM
how to check for duplicated words / cells ? Spell check adding words riweir Word 3 11-30-2011 09:03 PM
Words are duplicated on print agentred Word 1 06-29-2010 08:45 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:19 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft