View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default A button for Center Across Selection

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"
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