View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Simulate click of AutoSum doesn't work in 2007

This vintage code still seems to work in Excel 2007.

Sub DoAutoSum()
Dim x As CommandBarControl
Set x = CommandBars.FindControl(ID:=226)
Set x = x.Controls(1)
x.Execute 'AutoSum
If Selection.Cells.Count = 1 Then
x.Execute 'Again to exit edit mode
End If
End Sub

--
Jim
"XP" wrote in message
...
| In the past I have used the following code line to simulate a click of the
| "AutoSum" button.
|
| Application.CommandBars("Standard").Controls("&Aut oSum").Execute
|
| This doesn't work in 2007; recording the macro doesn't work either. Anyone
| have an equivalent that works in 2007; if so could you please post?
|
| Thanks in advance for your assistance.