Question : Macro to merge columns in Word tables

Thank you for your help.

I would like to merge columns, but not rows in various tables I've produced in Microsoft Word.  I'm wondering if anyone can provide me with a macro that will accomplish this.  I have to merge different columns depending on table.  Plus, I don't want to merge the columns in the first row of the table (title bar).  It would be ideal to have a macro that would just merge (across columns) whatever cells I have selected.

Answer : Macro to merge columns in Word tables

This macro is designed to do that
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Sub MergeSelectedCells()
    Dim tbl As Table
    Dim rng As Range
    Dim lCol As Integer
    Dim tRow As Integer
    Dim rCol As Integer
    Dim bRow As Integer
    Dim r As Integer
    
    Set tbl = Selection.Range.Tables(1)
    tRow = Selection.Cells(1).RowIndex
    bRow = Selection.Cells(Selection.Cells.Count).RowIndex
    lCol = Selection.Cells(1).ColumnIndex
    rCol = Selection.Cells(Selection.Cells.Count).ColumnIndex
    For r = tRow To bRow
        Set rng = tbl.Cell(r, lCol).Range
        rng.End = tbl.Cell(r, rCol).Range.End
        rng.Cells.Merge
    Next r
Random Solutions  
 
programming4us programming4us