Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Sum Function 1

Status
Not open for further replies.

DSerr77

Technical User
Jul 21, 2004
42
US
I use the sum function endlessly and I want to create a keyboard shortcut to insert the sum function. However, when I write a macro to do so it does not auto select the range. Does anyone know how I can write a macro to insert the sum function and auto identify the correct range. Thanks for any suggestions.
 
Hi,

Why don't you use the AutoSum Icon on the toolbar?

Otherwisw, past this in a MODULE
Code:
Sub MyAutoSum()
   With ActiveSheet.UsedRange
      ActiveCell.Formula = "=SUM(" & Range(Cells(.Row, ActiveCell.Column), Cells(ActiveCell.Row - 1, ActiveCell.Column)).Address(False, False) & ")"
   End With
End Sub


Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
There already is a keyboard shortcut for AutoSum.

<ALT>+<=> will do the same thing, along with autoselecting the range!


John

Every generalization is false, including this one.
 
John,

Kudos! For some reason, Keyboard Shortcuts were/are never high on my list. ==> *

Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
Thanks, Skip!

I am a lazy, lazy man. Anytime I can use a keyboard shortcut rather than going *all* the way over to my mouse, I'll do it.

John

Every generalization is false, including this one.
 
One they don't have listed on selecting cells is CTRL+* which selects the Current Region.

Regards
Ken................

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top