G
Greg
I am trying to determine if a table contains split or merged cells. I
am close, but not there yet.
Using the following code and comparing the cell count to the the
product of the total row count and total column count, I can determine
if the table has split cells, merged cells, or a combinationof both,
provided that the combination of split and merges don't cancel each
other out.
Sub Test()
Dim oCell As Cell
Dim oColTotal&, oRowTotal&, i&, j&, k&
Dim Msg$
k = 0
For Each oCell In Selection.Tables(1).Range.Cells
i = oCell.ColumnIndex
If i > oColTotal Then oColTotal = i
j = oCell.RowIndex
If j > oRowTotal Then oRowTotal = j
k = k + 1
Next oCell
If k <> oColTotal * oRowTotal Then
MsgBox "Table contains split or merged cells."
Else
MsgBox "Table does not contain split or merged cells."
End If
End Sub
Is there some method that I am unaward of that detects split or merged
cells in a table?
Thanks.
am close, but not there yet.
Using the following code and comparing the cell count to the the
product of the total row count and total column count, I can determine
if the table has split cells, merged cells, or a combinationof both,
provided that the combination of split and merges don't cancel each
other out.
Sub Test()
Dim oCell As Cell
Dim oColTotal&, oRowTotal&, i&, j&, k&
Dim Msg$
k = 0
For Each oCell In Selection.Tables(1).Range.Cells
i = oCell.ColumnIndex
If i > oColTotal Then oColTotal = i
j = oCell.RowIndex
If j > oRowTotal Then oRowTotal = j
k = k + 1
Next oCell
If k <> oColTotal * oRowTotal Then
MsgBox "Table contains split or merged cells."
Else
MsgBox "Table does not contain split or merged cells."
End If
End Sub
Is there some method that I am unaward of that detects split or merged
cells in a table?
Thanks.