' Reverts the current cell to original style Remove cell formatting Sub CellFormatSpecialNOT() ' Changes the current cell to specific background color for Low values ForegroundPatternColor = wdColorAutomaticĮnd Sub CellFormatSpecialLow Sub CellFormatSpecialLow() ' make sure there's no Texture or foreground color setting ' Changes the current cell to specific background color for High values Exact Copy Multiple Cells without changing formula reference Auto Create.
CellFormatSpecialHigh Sub CellFormatSpecialHigh() Copy and paste the large range of data into Word document, and then select. Unlock a table: Click the table, then choose Arrange > Unlock. BackgroundPatternColor to ‘Automatic’ which, in effect, means the table style setting. Lock a table: Click the table, then choose Arrange > Lock (from the Arrange menu at the top of your screen). To remove the special cell formatting use this code: To resize specific rows or column, click on a cell and then adjust the row/column.
On the Layout tab, you can specify the custom height and width. The contextual tabs, Table Design and Layout, appear in the ribbon. Sub CellFormatbyName( “HighValue” ), Sub CellFormatbyName( “Special” ). Resize rows, columns, or cells Select the table. Accepting a name then applying cell formatting based on that name e.g. Or a function which, in effect, gives you individual cell styles. Sub CellFormatBackground( wdBlue ) Cell Styles via VBA
#Resize one cell only in table in word for mac code#
The code could be changed so there’s a single function with a parameter passed in with the background color desired e.g. If Selection.Information(wdWithInTable) ThenĮnd If Single function for different background It will apply shading to whatever selection is current when the function is run.Ī quick but incomplete check is possible using this code which checks if the selection is inside a table. The code assumes it’s only run with a cell or cells selected. Checking cell selectionĪs noted in the code comments, there’s no error checking. Here’s some extensions and improvements you might try. In particular there’s no checking of the selection to make sure it’s a table cell.Īdd these functions to a button on the ribbon or Quick Access Toolbar We’ve deliberately made this code very simple since most Word users aren’t familiar with VBA. It also ensures the texture and foreground colors don’t obscure the background coloring. This code changes the background color for the current selection. We’ve made two VBA functions for two different cell formatting settings CellFormatSpecialHigh and CellFormatSpecialLow. Reuse this code to apply the same formatting to many cells. In effect it makes styles for cells in a way that Word itself won’t do. Resize a table On your computer, open a document and select all cells. It’s possible to apply individual cell formatting in Word consistently using a little VBA code. Resize rows and columns On your computer, open a document or presentation.