How to use Excel to tally without pressing the enter key

Greg Moore

New Member
Joined
Jul 23, 2024
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
Hello,
I would like to use Excel to tally counts that I do. In an ideal setting I would place the cursor in A1 and enter multiple characters such as "///.,,./" to represent different items. I can get a running count if I press the enter key after each character click or at the end. My problem is that I want to update the tally with each key stroke so I can see when I reach 100 without pressing the enter key.

Any assistance is appreciated.

Greg
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Welcome to the Forum!

Perhaps something along these lines? (I have used the down arrow key as the counter)

VBA Code:
Sub StartTally()

    Application.OnKey "{Down}", "Tally"

End Sub
Sub StopTally()

    Range("A1").ClearContents
    Application.OnKey "{Down}"

End Sub
Sub Tally()
    
    Range("A1").Value = Range("A1").Value + 1

End Sub

This can easily be expanded for simultaneous tallies of more than one item. The question wasn't completely clear on this point.
 
Upvote 0
Solution
It is good to be part of the forum.

Very appreciative of your help. I played around with the macro and came up with the following. It facilitates multiple simultaneous tallies and will work well as is, but I have one remaining question. Instead of the B, N, and M keys, is it possible to code for the comma, period and forward slash keys to be used? Tried to directly substitute them into the code, but didn't work.

1721791807708.png
 
Upvote 0
Just wrap in brackets, e.g.

Application.OnKey "{/}", "Tally"

You will probably find that "/" brings up the keyboard shortcuts menu. To stop this happening, go to the end of File/Options/Advanced and clear the box that says "Microsoft Excel menu key" (assuming you're happy not to have this functionality).

1721792958496.png
 
Upvote 0

Forum statistics

Threads
1,221,513
Messages
6,160,244
Members
451,632
Latest member
purpleflower26

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