This article is cropped to provide you with 2 quick and manageable ways to auto fit tables to contents or Page in your Word document.
Inserting a table to hold data is now inevitable in Word using. More often than not, we don’t stop in merely having a table but try to make it look great in document. This means we will need to properly adjust table size accordingly.
Now, let’s first take a look at occasions when we must change a table size:
- It’s pretty often to insert a new page in landscape orientation. Then you originally perfect table could be too small in the new page setup.
- The size of table cells intends to change according to word numbers. This absolutely will undermine the document outlook.
See the example below:
Next, let’s get down to our business today to introduce you the 2 solutions here.
Method 1: Alter Manually
- First and foremost, click to select the whole table.
- Then, click “Layout” tab under “Table Tools”.
- Next, go to “Cell Size” group to click “AutoFit”.
- And on the drop-down menu, choose what you need accordingly, such as “AutoFit Contents” or “AutoFit Window”. The former means to change table size according to contents size, while the latter refers to change of table size due to page setup.
Here is what you may get:
As you can see, this method works best when there are only a few tables to manage. However, when a large number of tables are involved, let’s take a more smart and quick way.
Method 2: Use VBA Codes to Do it in Batch
- To begin with, make sure your “Developer” tab is available in the Ribbon and click it. If not, click here and jump to this article: How to Insert Background Music into Your Word Document
- Then, click “Visual Basic” in “Code” group to open VBA editor.
- On the left “Project” pane, find the project with document name after it. And click “ThisDocument”.
- Next, click “Insert” on toolbar.
- And choose “Module” on the list.
- Now the editing area shall expand on the right side. If you want to AutoFit tables according to contents, you should paste the following codes there:
Private Sub AutoFitContentsForAllTables() If ActiveDocument.Tables.Count > 0 Then Dim objTable As Object Application.Browser.Target = wdBrowseTable For Each objTable In ActiveDocument.Tables objTable.AutoFitBehavior (wdAutoFitContent) Next End If End Sub
- Or if you need to AutoFit tables according to window width, the bellowing codes are helpful:
Private Sub AutoFitWindowForAllTables() If ActiveDocument.Tables.Count > 0 Then Dim objTable As Object Application.Browser.Target = wdBrowseTable For Each objTable In ActiveDocument.Tables objTable.AutoFitBehavior (wdAutoFitWindow) Next End If End Sub
- Once you finish there, just click “Run”.
Take Care of Your Information
Generally, there must be hundreds of thousands irreplaceable information stored on your digital devices. To be honest, it’s quite tiresome to manage every piece of them properly. One way we can do without much cost should be taking backups. It helps to keep these files stay safe and sound. However, no guarantee can be made. For instance, the Word we use almost every day can stop working all of a sudden. That time you will need a tool to recover corrupt Word.
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged Excel fix tool and pdf repair software products. For more information visit www.datanumen.com