
Tips.Net > ExcelTips Home > Formatting > Creating a Center Across Selection Button
Summary: The Merge and Center tool is used to do just what it says—merge cells and center their contents. If you want to center information across cells without merging, then you’ll love the short macro presented in this tip. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)
If you are a long-time user of Excel, you know that in versions of the program up through Excel 95, there was a toolbar button that would center the contents of a particular cell across a number of columns. In Excel 97 this toolbar button was replaced with one that merges cells and centers the content within the merged cells. The difference, of course, between the two tools is that one merges prior to centering, and the other does not.
If you miss the old Center Across Selection button, you may wonder if you can ever get it back. (You probably know that you can do the same thing by choosing Format | Cells | Alignment and then use the Horizontal drop-down list to choose Center Across Selection.) There is no built-in Center Across Selection tool that you can place on the toolbar, but you can create a simple macro that will do the same thing:
Sub CenterAcrossColumns()
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.MergeCells = False
End With
End Sub
Once you have the macro, you can assign it to a shortcut key or to a toolbar button. The macro can then be easily added to your Personal.xls sheet (as described in other issues of ExcelTips) so it is available from all your workbooks.
Tip #1944 applies to Microsoft Excel versions: 97 2000 2002 2003
Organize Your Data! Using the powerful sorting capabilities of Excel can help you get your data into just the order you need. Find out how you can use the full capabilities of sorting to your benefit.
Check out ExcelTips: Serioius Sorting today!
If you have tons of data to analyze, one of the best tools in Excel's arsenal is the PivotTable. Learn how to use this tool to analyze your data. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site