+ Post New Thread
Results 1 to 12 of 12
Office Software Thread, Highligh Rows in Word Table in Technical; Is it possible to highlight a row in a 4 column table, based on a value in the fourth column? ...
  1. #1
    jimbojames136's Avatar
    Join Date
    Mar 2011
    Location
    Hull
    Posts
    29
    Thank Post
    6
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Highligh Rows in Word Table

    Is it possible to highlight a row in a 4 column table, based on a value in the fourth column?


    thanks

    james

  2. #2

    Jawloms's Avatar
    Join Date
    Aug 2007
    Posts
    829
    Thank Post
    177
    Thanked 105 Times in 73 Posts
    Rep Power
    185
    Do you mean this?

    How To Highlight Rows Based on a Cell Value in Excel - Jon Gallant&#39s Blog - Site Home - MSDN Blogs

  3. #3
    jimbojames136's Avatar
    Join Date
    Mar 2011
    Location
    Hull
    Posts
    29
    Thank Post
    6
    Thanked 1 Time in 1 Post
    Rep Power
    0
    No i mean in Microsoft Word....

    I have a table with 4 columns and i want to be able to colour a row based on the 4th column?

  4. #4

    Join Date
    Oct 2010
    Posts
    23
    Thank Post
    6
    Thanked 1 Time in 1 Post
    Blog Entries
    2
    Rep Power
    42
    I don't think you can do this in Word. If your values are changing, so that you want the formatting to update too, perhaps you could prepare your table in Excel and link the table to display it in Word?

  5. #5
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,488
    Thank Post
    282
    Thanked 196 Times in 167 Posts
    Rep Power
    76
    Conditional formatting in Excel will do this, but Word can't - does it have to be in Word?

  6. #6
    jimbojames136's Avatar
    Join Date
    Mar 2011
    Location
    Hull
    Posts
    29
    Thank Post
    6
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Yes, it is an individual report from SIMS so it has to be in word, as far as im aware! I got a VB script to look at the column that i want, and select it, but i do not know how to make it look at the data. One would have thought it would be an IF statement of some kind.
    But i am no VB Scripter and could be talking utter rubbish!!!

  7. #7

    Jawloms's Avatar
    Join Date
    Aug 2007
    Posts
    829
    Thank Post
    177
    Thanked 105 Times in 73 Posts
    Rep Power
    185
    If it's a report from SIMS, can't you change the output to Excel, or make your own version of it which goes to Excel?

  8. #8
    jimbojames136's Avatar
    Join Date
    Mar 2011
    Location
    Hull
    Posts
    29
    Thank Post
    6
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Not sure you can change the output of an Individual Report from SIMS. I know you can do this with Standard SIMS Reports......

  9. #9

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,404
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    Try this...it's Word 2003 but should work for later versions...
    Code:
    Public Sub highlighter()
    
    Dim obj As Table
    
    
    Set obj = ActiveDocument.Tables(1)
    
    
    For x = 1 To obj.Rows.Count
        If Val(obj.Rows(x).Cells(7).Range.Text) < 3 Then
            obj.Rows(x).Shading.BackgroundPatternColor = wdColorGray20
        End If
    Next
    
    
    End Sub

  10. #10
    jimbojames136's Avatar
    Join Date
    Mar 2011
    Location
    Hull
    Posts
    29
    Thank Post
    6
    Thanked 1 Time in 1 Post
    Rep Power
    0
    That seems to Highlight the whole thing....

    Attached is the table, i need it to automatically highlight a row that contains a Y in Concern column. I cannot do this in Excel as it is an Individual Report from SIMS and as far as im aware you cannot change the output of a Individual Report to Excel.
    Any help would be much appreciated.

    Table1.doc

  11. #11

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,404
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    You just needed to change the cell references and the value check to match your data...
    Try this
    Code:
    Public Sub highlighter()
    
    Dim obj As Word.Table
    Dim x As Integer
    
    
    Set obj = ActiveDocument.Tables(1)
    
    
    For x = 1 To obj.Rows.Count
        If Left(obj.Rows(x).Cells(4).Range.Text, 1) = "Y" Then
            obj.Rows(x).Shading.BackgroundPatternColor = wdColorGray20
        End If
    Next
    
    
    End Sub

  12. Thanks to CESIL from:

    jimbojames136 (6th March 2012)

  13. #12
    jimbojames136's Avatar
    Join Date
    Mar 2011
    Location
    Hull
    Posts
    29
    Thank Post
    6
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Thanks Cesil..... that worked.

    Really appreciate that!

SHARE:
+ Post New Thread

Similar Threads

  1. [MS Office - 2007] Blank Rows in Tables
    By CarpeDiem in forum Office Software
    Replies: 6
    Last Post: 6th March 2012, 07:44 AM
  2. [MS Office - 2007] forcing Save as 97-2003 in Word 2007 corrupts tables
    By joe90bass in forum Office Software
    Replies: 11
    Last Post: 7th February 2009, 12:24 PM
  3. VB code to colour cells in a word table
    By park_bench in forum Coding
    Replies: 4
    Last Post: 30th June 2008, 08:52 AM
  4. Replies: 0
    Last Post: 13th January 2006, 10:55 AM
  5. text in word all greek to me
    By beeswax in forum Windows
    Replies: 14
    Last Post: 8th October 2005, 01:59 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •