View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default two cell accumulator

sub AddtoTotal()

if isnumeric(Range("A1")) then Range("B1") = Range("B1")+Range("A1")

end sub


Is the simplest way I can think of.

"JCook423" wrote:

Hello, I came across this,

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "A1" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("B1").Value = Range("B1").Value + .Value
Application.EnableEvents = True
End If
End If
End With
End Sub

which works fine by dropping it into the sheet coding. However what Im
trying to do is alter this code so I can €śAssign Macro€¦€ť it to a
button/object/autoshape that I can click to trigger the event instead of the
event trigger automatically as it does now.