centering text on the page vs. centering text in a column


Posted by Sue on January 22, 2002 7:56 AM

I have several worksheets with columns of text with headings for each column and a 3 to 4 line heading at the top of each page. I would like to center the 3 to 4 line heading on the page. How do I do that?

Posted by Joe Was on January 22, 2002 8:12 AM

Select one row, block select the colums you want your text to span, Right click. Select cell format-alignment, check merge cells. JSW

Posted by Brian Lange on January 22, 2002 11:18 AM

Can that task be accomplished by a macro of some sort? I am thinking about several macros to set the layout of my sheet. Is this possible and how would I go about collecting/creating these macros? My data is generated from a previous excel spreadsheet. Just looking to simplify the layout setup in a timely manner for printing purposes. Thanks.

Brian



Posted by Joe Was on January 22, 2002 11:37 AM

ActiveCell.FormulaR1C1 = "Test Text"
Range("A1:D1").Select
With Selection
.HorizontalAlignment = xlCenter
.WrapText = False
.ShrinkToFit = False

.MergeCells = True

End With
Selection.Font.Bold = True

Or,

ActiveCell.FormulaR1C1 = "Test Text"
Range("A1:D1").Select
With Selection
.HorizontalAlignment = xlCenter
.WrapText = False
.ShrinkToFit = False
.MergeCells = False
End With

Selection.Merge

Selection.Font.Bold = True

Both work, the first does it in the formatt the second does it outside of the format block. Its the "Merge." In this case the test text is added to cell A1 and A1 id formatted to center across A1 to D1, the text is also bolded. JSW