count changes to a cell

Strikk

New Member
Joined
Aug 29, 2018
Messages
2
Hello,

I'm not sure if this is entirely possible but I'm trying to find a way to simply have cell count up by 1 everytime another cell changes value.

Eg//
Cell 1A has the formula =rand()*10
Cell 2A would add by 1 every time excel refreshes and changes the value.

Alternatively, if code doesn't register auto-calculations as a change, i'm happy for it to change on a manual input.

End goal is to count the amount of 'runs' that has occurred in a cricket match.
so every time you add a run to the score, a cell somewhere else is auto counting the amount of overs bowled.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the Board!

You should be able to use a Worksheet_Calculate event procedure to do that.

Right-click on the sheet tab name (on the sheet you want to apply this to) at the bottom of the screen, select "View Code", and paste this code in the resulting VB Editor window.
Code:
Private Sub Worksheet_Calculate()
'   Disable events temporarily so updated the count doesn't trigger to count itself
    Application.EnableEvents = False
'   Increment cell A2 by 1
    Range("A2") = Range("A2") + 1
'   Reenable events
    Application.EnableEvents = True
End Sub
 
Last edited:
Upvote 0
You are welcome.
Glad I was able to help!:)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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