ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   two cell accumulator (https://www.excelbanter.com/excel-programming/435764-re-two-cell-accumulator.html)

Sam Wilson

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.



All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com