Not sure how to do the DATABASE field to do the table creation. That sounds like a better option than the macro. I would love to try that. Can you elaborate on that? I included an attachment so you can see how my form is outlined.
I also tried this code that I found online. Except it gave me an error message that read: "Run-time error 5991
Cannot access individual rows in this collection because the table has vertically merged cells". Any ideas?
Sub ActiveTableDeleteEmptyCells()
Dim oTable As Word.Table
Dim oCell As Word.Cell
Dim iCell As Integer
Dim iRow As Integer
Dim iCol As Integer
Application.ScreenUpdating = False
Set oTable = ActiveDocument.Bookmarks("Deftab").Range.Tables(1)
iCell = ActiveDocument.Bookmarks("Deftab").Range.Cells(1). Row.Index
With oTable
For iRow = .Rows.Count To iCell Step -1
For iCol = 1 To .Columns.Count
Set oCell = .Cell(iRow, iCol)
If Len(Trim(oCell.Range.Text)) = 2 Then
oCell.Delete Shiftcells:=wdDeleteCellsShiftUp
End If
Next
Next
End With
Set oCell = Nothing
Set oTable = Nothing
End Sub
|