Auto Sum in the Same Cell

CarlCarlos

New Member
Joined
Jan 12, 2011
Messages
31
Dear all,

I have had an odd request, and for the life of me cannot think of a way to do it or if it is even possible:

My colleague wishes to type a '1' or a 'Y' into cell B1, this 1 or Y will represent a good response to a questionaire. She wishes to put a 1 into this cell for every good response and wants it to sum how many times she puts a 1 into it.

Now i know it is not hard to put a 1 in and then next response put a 2,3 etc etc.

But i was wondering if it was possible for this to be done automatically
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try this: right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B1" Then
    Application.EnableEvents = False
    Application.Undo
    Target.Value = Target.Value + 1
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Try this: press Delete to decrease by 1

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B1" Then
    Application.EnableEvents = False
    If Target.Value = "" Then
        Application.Undo
        Target.Value = Target.Value - 1
    Else
        Application.Undo
        Target.Value = Target.Value + 1
    End If
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,740
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top