AFAIK“就是这样”,但是您可以使用 Cell.Tables 而不是 Cell.Range.Tables 来查找包含表格的单元格。例如,在当前选择中查找包含您可以使用的表格的单元格
Sub listInnerTables()
Dim c As Cell
Dim r As Range
Dim t As Table
Dim tcount As Long
Set r = Selection.Range
If r.Tables.Count > 0 Then
tcount = 0
For Each t In r.Tables
tcount = tcount + 1
For Each c In t.Range.Cells
If c.Range.InRange(r) Then
If c.Tables.Count > 0 Then
Debug.Print "Table: " & CStr(tcount) & _
vbTab & " Row: " & CStr(c.RowIndex) & _
vbTab & " Col: " & CStr(c.ColumnIndex) & _
vbTab & " Table count: " & CStr(c.Tables.Count)
End If
End If
Next
Next
End If
Set r = Nothing
End Sub