View Single Post
 
Old 03-22-2021, 02:18 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,164
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The macro I created told you WHICH table has the most columns. Surely that was your original question.

Quote:
Originally Posted by Cendrinne View Post
I wish to have a macro to count for me the table with the most columns.

So among my 100's of tables, have a macro that would tell me ''the table with the most columns is 10 in this currant Word document''...
If my macro was telling you 5 then that means the 5th table has the most columns. I also included that column count in the MsgBox title - although Greg thought that was an error and he moved it to the body of the MsgBox.

Did you also want to scroll to that (first) table with the most columns? If so, add another line at the bottom of the code
Code:
If iTbl > 0 Then ActiveDocument.Tables(iTbl).Range.Select
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote