Reputation: 121
I have to find and alert that if empty cell found in each tables in power point.
I have found the below code here, but it does not work and it should not be find for all table, not for selected one.
Sub CheckTableCells()
Dim oCell As Cell
Dim oRow As Row
Dim MyRange As Range
For Each oRow In Selection.Tables(1).Rows
For Each oCell In oRow.Cells
If Selection.Text = Chr(13) & Chr(7) Then
oCell.Select
MsgBox oCell.RowIndex & " " & oCell.ColumnIndex & " is empty."
End If
Next oCell
Next oRow
End Sub
Please anyone help me for this.
Upvotes: 1
Views: 446
Reputation: 1275
This code loops through each slide in the active presentation, and in each slide, check whether the each shape on the slide contains a table, and if it does, checks whether each cell is blank. Cheers.
Sub CheckTableCells()
Dim vSlide As Slide
Dim vShape As Shape
Dim vRow As Long
Dim vColumn As Long
For Each vSlide In Application.ActivePresentation.Slides
For Each vShape In vSlide.Shapes
If vShape.HasTable Then
For vRow = 1 To vShape.Table.Rows.Count
For vColumn = 1 To vShape.Table.Columns.Count
If vShape.Table.Cell(vRow, vColumn).Shape.TextFrame.TextRange.Text = "" Then
MsgBox vSlide.Name & " Table: """ & vShape.Name & """ cell (" & vRow & "," & vColumn & ") is blank."
End If
Next
Next
End If
Next
Next
End Sub
Upvotes: 2