Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2018, 03:08 PM
macropod's Avatar
macropod macropod is offline Risk Matrix table using Content Controls Windows 7 64bit Risk Matrix table using Content Controls Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


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")
Second, replace:
Code:
    If i = 1 Or j = 1 Then
      StrTxt = ""
    Else
      StrTxt = Split(Tbl.Cell(i + 1, j + 1).Range.Text, vbCr)(0)
    End If
with:
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
Done.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



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
Risk Matrix table using Content Controls Duplicating one or more table rows or an entire table with content controls kevinbradley57 Word VBA 10 08-17-2017 02:13 PM
Risk Matrix table using Content Controls 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

Other Forums: Access Forums

All times are GMT -7. The time now is 11:08 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