![]() |
|
|
|
#1
|
||||
|
||||
|
Word has nothing like Excel's COUNTIF function, but it isn't needed anyway. The code to implement the additional output is fairly straightforward.
First, define a new variable: Code:
Dim ArrRisks: ArrRisks = Array(" ", "Low", "Moderate", "Significant", "High")
Code:
If i = 1 Or j = 1 Then
StrTxt = ""
Else
StrTxt = Split(Tbl.Cell(i + 1, j + 1).Range.Text, vbCr)(0)
End If
Code:
If i = 1 Or j = 1 Then
StrTxt = " "
Else
StrTxt = Split(Tbl.Cell(i + 1, j + 1).Range.Text, vbCr)(0)
End If
For i = 0 To UBound(ArrRisks)
If ArrRisks(i) = StrTxt Then Exit For
Next
With ActiveDocument.SelectContentControlsByTitle("Highest Residual Risk")(1).Range
For j = 0 To UBound(ArrRisks)
If ArrRisks(j) = .Text Then Exit For
Next
If i > j Then .Text = StrTxt
End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| insert the 2 content controls into a Repeating Section in a table | smaccharoli | Word VBA | 2 | 02-27-2018 08:49 AM |
Duplicating one or more table rows or an entire table with content controls
|
kevinbradley57 | Word VBA | 10 | 08-17-2017 02:13 PM |
2nd matrix gives a resut that doesnīt match numbers in the 1st matrix
|
Diver | Excel | 25 | 02-22-2017 04:39 PM |
| Macro to save docx to doc that checks compatibility and converts content controls to static content. | staicumihai | Word VBA | 4 | 10-12-2016 08:23 PM |
| Content Controls - Add Table Rows | dgiromini | Word VBA | 1 | 04-11-2014 03:04 PM |