Discussion:
Macro to merge cells?
(too old to reply)
kipster
2012-05-11 07:45:25 UTC
Permalink
I need help with a macro to merge a specified set of cells in a table i
a Word 2007 document. My goal is to use code to avoid having to tel
hundreds of users which cells to select and merge in a large table
since asking them to do that would inevitably lead to problems. Wha
I've determined so far is that I can't record such a macro, because
can't select the table cells once the macro recorder is active. Once th
cells are merged, I want to enter and format text, also using the macr
(since it will always say exactly the same thing, to meet regulator
requirements)
As an example, I'd like a macro that will
Merge the cells from row 32, column 18 through row 38, column 2
Enter the text "Approved Document" in the merged cell and format it a
bold and red
Any and all help will be greatly appreciated
Code
-------------------
Sub Macro1(

Dim myCells As Rang
With ActiveDocumen
Set myCells = .Range(Start:=.Tables(1).Cell(32, 18).Range.Start,
End:=.Tables(1).Cell(38, 25).Range.End
myCells.Selec
End Wit
Selection.Cells.Merg
With Selection.Fon
.Bold = Tru
.Color = wdColorRe
End Wit
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCente
Selection.ParagraphFormat.Alignment = wdAlignParagraphCente
Selection.TypeText Text:="Approved Document

End Su
-------------------

Does that help


--
kipster
Andy Entrekin
2012-05-11 23:06:57 UTC
Permalink
That did it - thanks!!


--
Andy Entrekin

Loading...