View Single Post
 
Old 12-04-2020, 02:28 AM
Richystab Richystab is offline Windows 10 Office 2019
Novice
 
Join Date: Dec 2020
Posts: 12
Richystab is on a distinguished road
Default Managed now

Quote:
Originally Posted by macropod View Post
In what way can't you get it to work?

For PC macro installation & usage instructions, see: Installing Macros
For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
I managed in the end using this
Code:
Sub HideRowWhereSecondColumnBlank()
  Dim Pwd As String
  Dim oRow As Integer
  Dim oTable As Table
  Dim iTable As Table
  Dim pState As Boolean
  With ActiveDocument
    pState = False

    If .Tables.Count > 0 Then
      For Each iTable In .Tables
        If iTable.Tables.Count > 0 Then
          For Each oTable In iTable.Tables
            For oRow = oTable.Rows.Count To 1 Step -1
              If Len(Replace(oTable.Cell(oRow, 2).Range.Text, Chr(13) & Chr(7), vbNullString)) = 0 Then
                 On Error Resume Next 'skip vertically merged cells
                 oTable.Rows(oRow).Delete
              End If
            Next oRow
          Next oTable
        End If
      Next iTable
    End If
    If pState = True Then .Protect wdAllowOnlyFormFields, Noreset:=True, Password:=Pwd
      pState = False
    Pwd = ""
  End With
 
End Sub