A button for Center Across Selection

J

Jaleel

In the old versions of Excel there was a button for Center Across Selection,
which has now turned to Merge and Center. If this button is pressed with
multiple rows, it swallows all the rows below the first row, whereas the old
version button functions it properly. Further this creates hassle with
sorting etc. I prefer the Merge and Center button to function as the old
Center Across Selection for multiple rows as we have a button now for merging
cells at the same time we do not have a button for Center Across Selection.
Am I right?

Jaleel

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...d-3eb70de61646&dg=microsoft.public.excel.misc
 
J

Jim Cone

Jaleel,
Add a custom button to a toolbar and assign this code to it...
'----------------
Sub CenterAcrossSelection()
On Error GoTo CenterErr
If TypeName(Selection) = "Range" Then
If IsNull(Selection.HorizontalAlignment) Or _
Selection.HorizontalAlignment = xlHAlignCenterAcrossSelection Then
Selection.HorizontalAlignment = xlHAlignGeneral
Selection.VerticalAlignment = xlVAlignBottom
Else
Selection.HorizontalAlignment = xlHAlignCenterAcrossSelection
Selection.VerticalAlignment = xlVAlignCenter
End If
End If
Exit Sub
CenterErr:
Beep
End Sub
------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"Jaleel" <[email protected]>
wrote in message
In the old versions of Excel there was a button for Center Across Selection,
which has now turned to Merge and Center. If this button is pressed with
multiple rows, it swallows all the rows below the first row, whereas the old
version button functions it properly. Further this creates hassle with
sorting etc. I prefer the Merge and Center button to function as the old
Center Across Selection for multiple rows as we have a button now for merging
cells at the same time we do not have a button for Center Across Selection.
Am I right?
Jaleel
 
G

Gord Dibben

I cannot recall any version of Excel having a "Center acrosss selection" button.

I built a macro years ago when running Excel 97.

Sub TOGGLECENTERACROSS()
With Selection
If .HorizontalAlignment = xlCenterAcrossSelection Then
.HorizontalAlignment = xlGeneral
Else
Selection.HorizontalAlignment = xlCenterAcrossSelection
End If
End With
End Sub


Gord Dibben MS Excel MVP
 
G

grinny

In my V2003 Center Across Selection is available in Format Cells | Alignment
| Text Alignment, Horizontal -- scroll down.
 
J

Jaleel

Thanks Jim. Thanks Gord. It worked perfectly. Now I have a button for CAS.

Regards,

Jaleel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top