How to highlight rows in Table, at one go, in Microsoft Word, depending upon a criteria

Anonymous
2020-06-08T09:05:23+00:00

Dear Sir/Madam,

I would like to highlight all the rows in the MS Word document containing word "SPDC-JK", i have highlighted two such rows using "Yellow" interior color, however, i have done this manually.

Kindly note that, the document was initially available in PDF and i have converted it to "Word" document, because converting to "Excel" document, distorts the data-table.

The screenshot is enclosed below:-

As can be observed, i have highlighted with "Red Pen", the word "SPDC-JK", for which i would like to get the "Yellow"color highlighted automatically to the entire row, through some macro or some other MSWORD tool Tip.

There are 31 such instances in this table, which is spread over 7 pages.

If any any clarification or document requested, then please let me know.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Doug Robbins - MVP - Office Apps and Services 322.1K Reputation points MVP Volunteer Moderator
    2020-06-08T09:52:19+00:00

    If highlighting just the SPDC-JK, you could simply use the Find and Replace feature to find SPDC-JK and then select Highlight All from the Reading Highlight dropdown

    To highlight the whole row, it would be necessary to use a macro

    Dim i as Long

    With Selection.Tables(1)

        For i = 1 To .Rows.Count

            If InStr(.Rows(i).Cells(2).Range.Text, "SPDC-JK") > 0 Then

                .Rows(i).Shading.BackgroundPatternColor = wdColorYellow

            End If

        Next i

    End With

    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Suzanne S Barnhill 275K Reputation points MVP Volunteer Moderator
    2020-06-08T12:27:05+00:00

    Note that "Reading Highlight" is different from actual highlighting. For example, it does not print, and the highlight color cannot be changed.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2020-06-08T17:13:36+00:00

    Dear Sir,

    Thanks for the Heads up.

    I would like to take print out with "Yellow" color. Will the solution provided by Mr. Doug Robbins, not work in this case and in that case is macro the only solution.

    Will macro allow me to get colored printout?

    In other words, can we achieve actual highlighting in MSWord?

    Kindly let me know.

    Regards,

    Sandeep

    0 comments No comments
  3. Stefan Blom 325K Reputation points MVP Volunteer Moderator
    2020-06-08T20:55:48+00:00

    The way I interpret Doug's macro, it adds shading to cells. This formatting is part of the table and it will be printed.

    Text Color Highlight will print, but it only applies to the text, not to the table cells.

    Reading Highlight, as Suzanne said, is only temporary. It won't be preserved if you save, close and reopen the document, and it won't print.

    1 person found this answer helpful.
    0 comments No comments