Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I am not even sure that this can be done and I have no idea where t start on this one. Basically, I need a macro to add up the user selected cells and displa the result in the last row left one. for example. user selects cells C3:C10 the result needs to be displayed in B10 The user then selects C11:C32 the results need to be displayed in B32 The user can select any number of cells within colum C and the cell ro can be anything. Is there code which would allow this to happen using a button to star the macro after the highlighting of the cells? Thanks in advance -- RICOU ----------------------------------------------------------------------- RICOUK's Profile: http://www.excelforum.com/member.php...fo&userid=1879 View this thread: http://www.excelforum.com/showthread.php?threadid=39974 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Sum_Selected2()
Dim Rng As Range, rng1 As Range Set Rng = Selection Set rng1 = Rng.Areas(Rng.Areas.Count) Set rng1 = rng1(rng1.Rows.Count, rng1.Columns.Count) rng1.Offset(0, -1).Formula = "=Sum(" & Rng.Address & ")" End Sub Gord Dibben Excel MVP On Sat, 27 Aug 2005 12:10:37 -0500, RICOUK wrote: I am not even sure that this can be done and I have no idea where to start on this one. Basically, I need a macro to add up the user selected cells and display the result in the last row left one. for example. user selects cells C3:C10 the result needs to be displayed in B10 The user then selects C11:C32 the results need to be displayed in B32 The user can select any number of cells within colum C and the cell row can be anything. Is there code which would allow this to happen using a button to start the macro after the highlighting of the cells? Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Public Sub Button1_Click() With Selection .Item(.Count).Offset(0, -1).Value = _ Application.Sum(.Cells) End With End Sub Note that there's no error checking In article , RICOUK wrote: I am not even sure that this can be done and I have no idea where to start on this one. Basically, I need a macro to add up the user selected cells and display the result in the last row left one. for example. user selects cells C3:C10 the result needs to be displayed in B10 The user then selects C11:C32 the results need to be displayed in B32 The user can select any number of cells within colum C and the cell row can be anything. Is there code which would allow this to happen using a button to start the macro after the highlighting of the cells? Thanks in advance. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for that, my project is nearly complete, now I have just got t tidy up everything -- RICOU ----------------------------------------------------------------------- RICOUK's Profile: http://www.excelforum.com/member.php...fo&userid=1879 View this thread: http://www.excelforum.com/showthread.php?threadid=39974 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel change default column sort to current selection | Excel Worksheet Functions | |||
Capture Current Selection in a Combo Box | Excel Programming | |||
Update on Current Selection | Excel Programming | |||
Calculated value based on current line selection | Excel Programming |