Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-19-2016, 04:30 PM
Guessed's Avatar
Guessed Guessed is offline VBA to distribute all columns evenly within tables Windows 10 VBA to distribute all columns evenly within tables Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
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 following code will do what you asked.
Code:
Sub Macro1()
  Dim aTbl As Table
  For Each aTbl In ActiveDocument.Tables
    'aTbl.PreferredWidthType = wdPreferredWidthPercent
    'aTbl.PreferredWidth = 100
    If aTbl.Columns.Count > 1 Then aTbl.Range.Cells.DistributeWidth
  Next aTbl
End Sub
The two disabled lines could be enabled if you want all the tables to fill the width of the page as well.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
tables, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to distribute all columns evenly within tables VBA: Selecting columns from multiple tables LouterMattheus Excel Programming 1 07-22-2015 06:33 AM
VBA to distribute all columns evenly within tables Tables on a page in twomutiliple columns derklauer Word 1 05-15-2015 08:11 PM
VBA to distribute all columns evenly within tables Evenly Space Text Boxes in Word Squint Word 2 12-30-2013 09:08 AM
How do I add columns to existing tables? dpcalder Word 1 08-06-2013 09:49 AM
VBA to distribute all columns evenly within tables Columns or tables? Linda O Word 6 01-12-2011 08:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft