Adjust the top and bottom cell margins on the second row of all tables in the active Document by means of a macro

Andreas Hermle
Andreas Hermle used Ask the Experts™
Dear Experts:

I got hundreds of tables in my active Document. I would like to run a macro that performs the following action:

For all the tables in the active Document: Adjust the bottom and top cell margins to 0.1 cm for all the cells of the second row.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

pls try
Sub Macro()

For Each tbl In ActiveDocument.Tables
    Set rw = tbl.Rows(2)
    For Each c In rw.Cells
        c.TopPadding = CentimetersToPoints(0.1)
        c.BottomPadding = CentimetersToPoints(0.1)
End Sub

Open in new window

Andreas HermleTeam leader


Hi Rgonzo,

great, this did the trick. Thank you very much for your professional support. Regards, Andreas

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial