View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Steve Yandl[_2_] Steve Yandl[_2_] is offline
external usenet poster
 
Posts: 37
Default Summing random cells as you click on them

Ben,

For my example, I placed values in a 10 by 10 array on Sheet 1 (the range
A1:J10). I want values that I click to be in column "L" beginning in row 2.
I have a sub to turn the listing operation on and one to turn it off. You
can put command buttons on the sheet and attach the macro to the buttons.

In Module1 I have:

'------------------------------------
Public ExtractOn As Boolean

Sub ExtractBegin()
ExtractOn = True
End Sub

Sub ExtractStop()
ExtractOn = False
End Sub

'------------------------------------

Then, on sheet 1 I have this event driven subroutine

'--------------------------------------

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngList As Range
If ExtractOn = True Then
Application.EnableEvents = False
Set isect = Application.Intersect(Target, Range("A1:J10"))
If Not isect Is Nothing Then
Set rngList = Cells(Rows.Count, "L").End(xlUp)(2)
rngList.Value = Target.Value
End If
Application.EnableEvents = True
End If
End Sub

'---------------------------------------

Steve Yandl



"Ben in CA" <Ben in wrote in message
...
I need to create a "program" with an Excel document that allows me to click
a
button like "start adding" and then I can click on random cells (well,
they
wouldn't actually be random, but not in any series of columns or rows),
and
the contained values to be copied to successive cells in an empty column
on
the side, that I can then have a Sum setup up on.

Basically, I have different pieces of equipment listed in an Excel
spreadsheet, along with various options. (Several hundred) I want to be
able
to select which ones (even just by clicking on the price/value), and
automatically add them together - currently this is done on paper. (The
costs
of the various options, etc. are scattered about, and aren't all in a
particular row or column.)

Once I'm done calculating it, probably I'd need to have a "Stop adding"
button that I could press and then it would stop calculating the value.

Preferably it only copies the actual number in the cells to the new
location, as many of the cells are themselves calculated by formulas.

Can anyone think of a way of doing this? I've been looking around for a
way
to do this, but I haven't found anything that will do it yet.

Thanks in advance to anyone who solves this problem!