View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default TOOLBAR button or Keyboard Shortcut FOR Center Across Selectio

Bob

Please elucidate on the profligacy of repeating "Selection"

I cannot get the macro to work without using xlCenterAcrossSelection even
though inside the "with selection"


Gord

On Tue, 29 Apr 2008 17:48:46 +0100, "Bob Phillips"
wrote:

That could be the macro that I was suggesting, although I wouldn't be so
profligate as to repeat Selection <g

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

But I was thinking of a more basic macro, not a toggle

Sub CentreAcrossSelection()
Selection.HorizontalAlignment = xlCenterAcrossSelection
End Sub