Avatar of Andreas Hermle
Andreas HermleFlag for Germany asked on

Apply column widths of currently selected table to all tables using VBA

Dear Experts:

I got a document with ...
... hundreds of tables.
... all of them have the exact same number of columns

Now I would like to manually adjust the column widths in just one (1) table and then by running the macro (with the cursor residing in the table whose columns got adjusted), the column widths of the currently selected table are applied to all of the remaining tables.

Is it possible to run such a macro?  

And one more thing: One of the documents may have tables with just 3 columns, other documents may have tables with 7 columns (as I stated before, all of the tables in the documents have the same number of columns). The macro should be able to accommodate any numbers of columns. .

I wonder whether this is possible? Help is much appreciated. Thank you very much in advance.

Regards, Andreas
Microsoft Word

Avatar of undefined
Last Comment
Andreas Hermle

8/22/2022 - Mon
Steven Harris

One of the documents may have tables with just 3 columns, other documents may have tables with 7 columns

(as I stated before, all of the tables in the documents have the same number of columns). The macro should be able to accommodate any numbers of columns.

Can you clarify this?  Do they all have the same number of columns or not?
ASKER
Andreas Hermle

HI ThinkSpaceSolutions:

I would like to run the macro on different documents.
In one document for example all of the tables have 3 columns,
in another document all of the tables have 7 columns
in another document all of the tables have 2 columns
etc.

So the macro should be able to do its work in all documents. Within one document all tables have the same number of columns, between documents they can vary.

Thank you. Regards, Andreas
ASKER CERTIFIED SOLUTION
Chris Bottomley

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Andreas Hermle

Chris,

great job, Chris. Thank you very much for your professional help.

Regards, Andreas
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy