AutoSum
Ivan F Moala
Google
Can Do
Goto Guest book sign in page [Home]
Greatest place to be
Thanks for visiting my site lucky visitor:
This page was last updated on: April 25, 2006
Copyright © 2002. XcelFiles. All Rights Reserved Ivan F Moala
Tell a friend about this page
2 methods to automatically use the Autosum function key from VBA.

Note: Method uses commandbar Id's, as far as I know these id's are the same for versions 97+, or at least one would think so, bearing in mind that for compatibilty reasons microsift would/should NOT change these.

If you find this not to be the case then please let me know.
Option Explicit


Sub AutoSum1()
CommandBars.FindControl(ID:=226).Execute
Application.SendKeys "~"
End Sub

Sub AutoSum2()
With Application.CommandBars.FindControl(ID:=226)
.Execute
.Execute
End With
End Sub

The image above shows you what this code simulates ie. the pressing of the Autosum button, with a cell active.
NB: For XP it is different see here..................