Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
I've trying unsuccessfully to record a macro that will merge a table cell
with the cell to the right of it. Could anyone suggest code that would do this? |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Sub MergeCellToRight()
Dim oRng As Range Dim oCell As Cell Dim i As Long Set oCell = Selection.Cells(1) If oCell.ColumnIndex = Selection.Rows(1).Cells.Count Then MsgBox "There is no cell to the right?", vbCritical, "Error" Exit Sub End If Set oRng = oCell.Range oRng.MoveEnd wdCell, 1 oRng.Cells.Merge oCell.Select Selection.Collapse wdCollapseStart End Sub will merge the cell containing the cursor with the cell to the right -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news ![]() I've trying unsuccessfully to record a macro that will merge a table cell with the cell to the right of it. Could anyone suggest code that would do this? |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Sub MergeCellToRight()
Dim oRng As Range Dim oCell As Cell Dim i As Long Set oCell = Selection.Cells(1) If oCell.ColumnIndex = Selection.Rows(1).Cells.Count Then MsgBox "There is no cell to the right?", vbCritical, "Error" Exit Sub End If Set oRng = oCell.Range oRng.MoveEnd wdCell, 1 oRng.Cells.Merge oCell.Select Selection.Collapse wdCollapseStart End Sub will merge the cell containing the cursor with the cell to the right -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news ![]() I've trying unsuccessfully to record a macro that will merge a table cell with the cell to the right of it. Could anyone suggest code that would do this? |
#4
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Beautiful. Works like a charm. Thank you very much!
"Graham Mayor" wrote: Sub MergeCellToRight() Dim oRng As Range Dim oCell As Cell Dim i As Long Set oCell = Selection.Cells(1) If oCell.ColumnIndex = Selection.Rows(1).Cells.Count Then MsgBox "There is no cell to the right?", vbCritical, "Error" Exit Sub End If Set oRng = oCell.Range oRng.MoveEnd wdCell, 1 oRng.Cells.Merge oCell.Select Selection.Collapse wdCollapseStart End Sub will merge the cell containing the cursor with the cell to the right -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news ![]() I've trying unsuccessfully to record a macro that will merge a table cell with the cell to the right of it. Could anyone suggest code that would do this? . |
#5
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
Beautiful. Works like a charm. Thank you very much!
"Graham Mayor" wrote: Sub MergeCellToRight() Dim oRng As Range Dim oCell As Cell Dim i As Long Set oCell = Selection.Cells(1) If oCell.ColumnIndex = Selection.Rows(1).Cells.Count Then MsgBox "There is no cell to the right?", vbCritical, "Error" Exit Sub End If Set oRng = oCell.Range oRng.MoveEnd wdCell, 1 oRng.Cells.Merge oCell.Select Selection.Collapse wdCollapseStart End Sub will merge the cell containing the cursor with the cell to the right -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news ![]() I've trying unsuccessfully to record a macro that will merge a table cell with the cell to the right of it. Could anyone suggest code that would do this? . |
#6
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
You are welcome
![]() Dim i As Long was not actually used in the posted version of the macro and can be deleted -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Beautiful. Works like a charm. Thank you very much! "Graham Mayor" wrote: Sub MergeCellToRight() Dim oRng As Range Dim oCell As Cell Dim i As Long Set oCell = Selection.Cells(1) If oCell.ColumnIndex = Selection.Rows(1).Cells.Count Then MsgBox "There is no cell to the right?", vbCritical, "Error" Exit Sub End If Set oRng = oCell.Range oRng.MoveEnd wdCell, 1 oRng.Cells.Merge oCell.Select Selection.Collapse wdCollapseStart End Sub will merge the cell containing the cursor with the cell to the right -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news ![]() I've trying unsuccessfully to record a macro that will merge a table cell with the cell to the right of it. Could anyone suggest code that would do this? . |
#7
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
You are welcome
![]() Dim i As Long was not actually used in the posted version of the macro and can be deleted -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Beautiful. Works like a charm. Thank you very much! "Graham Mayor" wrote: Sub MergeCellToRight() Dim oRng As Range Dim oCell As Cell Dim i As Long Set oCell = Selection.Cells(1) If oCell.ColumnIndex = Selection.Rows(1).Cells.Count Then MsgBox "There is no cell to the right?", vbCritical, "Error" Exit Sub End If Set oRng = oCell.Range oRng.MoveEnd wdCell, 1 oRng.Cells.Merge oCell.Select Selection.Collapse wdCollapseStart End Sub will merge the cell containing the cursor with the cell to the right -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news ![]() I've trying unsuccessfully to record a macro that will merge a table cell with the cell to the right of it. Could anyone suggest code that would do this? . |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I Merge Cells in an Office 2007 table? | Tables | |||
macro to detect merged table cells? | Tables | |||
merge cells in a table | Tables | |||
table cells loose shading during merge operation | Mailmerge | |||
Select specific cells in table via macro | Microsoft Word Help |