I see now that the menu and autosum have the same value(226)
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"Ron de Bruin" wrote in message ...
Hi Jim
I try this first but it blow
Application.CommandBars.FindControl(ID:=226).Execu te
So posted this
Application.CommandBars.ExecuteMso ("AutoSum")
But yours is working OK
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"Jim Rech" wrote in message ...
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.