sykes
Well-known Member
- Joined
- May 1, 2002
- Messages
- 1,885
- Office Version
- 365
- Platform
- Windows
You know when you get a complete brain failure...............
How do I refer to the active (selected) range in a sheet?
I want to press commandbutton1, and simply sum the cells in whatever the active range is - so if I've selected T4:T10, for example, then press the button, I get a messagebox with the sum of all the values in the selected range. Should be so easy, but I can't remember how to refer to the current selection.
something like:
Any ideas Folks?
How do I refer to the active (selected) range in a sheet?
I want to press commandbutton1, and simply sum the cells in whatever the active range is - so if I've selected T4:T10, for example, then press the button, I get a messagebox with the sum of all the values in the selected range. Should be so easy, but I can't remember how to refer to the current selection.
something like:
Code:
dim cl as range
dim dbl as double
For each cl in activerange
dbl = dbl + cl.value
next
msgbox "£" & dbl
Any ideas Folks?