change event macro to add cells
Thank you GS this one looks great, and easier to understand, but how would I
be able to expand (I should have asked the first time) the range to include a
verticle range as the rb and rc values?
I tried changing the
Set rb = Range("B3") to Set rb = Range("B:B")
Set rc = Range("C3") to Set rc = Range("C:C")
and tried defining names for B3:B30 and same for C3:C30 and plugging the
names in but nothing. Would I have to make it an array!? Arrays mess with
my head.
Thanks for any help you can provide.
fryguy
"Gary''s Student" wrote:
Let's build an accumulator. From a clean sheet if we enter 5 in B3, then 5
will appear in C3. If we next enter 12 in B3, then 17 will appear in
C3...etc.
Private Sub Worksheet_Change(ByVal Target As Range)
Set rb = Range("B3")
Set rc = Range("C3")
If Intersect(Target, rb) Is Nothing Then Exit Sub
Application.EnableEvents = False
rc.Value = rc.Value + rb.Value
Application.EnableEvents = True
End Sub
--
Gary''s Student - gsnu200765
"fryguy" wrote:
how can i make an event macro to update the value in C3 when a new value is
entered in B3 without the need to click an update button.
thanks,
fryguy.
|