Do you mean this?
How To Highlight Rows Based on a Cell Value in Excel - Jon Gallant's Blog - Site Home - MSDN Blogs
Is it possible to highlight a row in a 4 column table, based on a value in the fourth column?
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?
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?
Conditional formatting in Excel will do this, but Word can't - does it have to be in Word?
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!!!
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?
Not sure you can change the output of an Individual Report from SIMS. I know you can do this with Standard SIMS Reports......
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
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.
You just needed to change the cell references and the value check to match your data...
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
jimbojames136 (6th March 2012)
Thanks Cesil..... that worked.
Really appreciate that!
There are currently 1 users browsing this thread. (0 members and 1 guests)