countif cell back to 0

jarhead58

Active Member
Joined
Sep 21, 2017
Messages
364
Office Version
  1. 2021
Platform
  1. Windows
How can I return my count to "0" after using this formula
Code:
=MOD(COUNTIFS(F13:T21,R2)+COUNTIFS(F13:T21,"Ground out")+COUNTIFS(F13:T21,"Fly out")+COUNTIFS(F13:T21,"Foul out")-1,3)+1
when F13:T21 are cleared? TIA
 
could you post the file again, it is working for me regardless of if I call it or put the code in each sub.
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I can not download file at work so I can not look at this until after work.
 
Upvote 0
Since you are calling a sub in the sheet1 from a module use
Code:
Call Sheet1.curinning
 
Upvote 0
Since you are calling a sub in the sheet1 from a module use
Code:
Call Sheet1.curinning

Thats got it! It's working the way I want....for now, until I find another tweak or 2 lol!!! Thanks so much for your time sir!!!
 
Upvote 0
Quick question for you! I've been trying to find out how I am incrementing my hits but can't determine how. I might be a bit wore out but I do know that I have I2:K2 and N2:Q2 cells set "=1". The only thing even pointing at that area is Module 2. TIA
 
Upvote 0
Quick question for you! I've been trying to find out how I am incrementing my hits but can't determine how. I might be a bit wore out but I do know that I have I2:K2 and N2:Q2 cells set "=1". The only thing even pointing at that area is Module 2. TIA

Nevermind, I definitely was tired. I somehow removed my formula for "Hits".
 
Upvote 0
Good Morning Scott

Decided to try something that I thought should be another simple 'Call' from a module like before. Here is the code I used. The Sub called.

Code:
Sub ChangeColor()

    If Range("F13:T21" = "N2") Then
        Range("AD16").Interior.Color = RGB(255, 255, 0)
        Else
    End If
    
End Sub

and the call from the module

Code:
Sub basehit()    Worksheets("Score").Range("N2").Copy
    ActiveSheet.Paste
    Application.CutCopyMode = False
    
    Call Sheet1.ChangeColor
End Sub

I'm getting an runtime error 1004: Application defined or object defined error. What did I miss? BTW, it is in the same coding window as the curinning sub.
 
Last edited:
Upvote 0
Good Morning Scott

Decided to try something that I thought should be another simple 'Call' from a module like before. Here is the code I used. The Sub called.

Code:
Sub ChangeColor()

    If Range("F13:T21" = "N2") Then
        Range("AD16").Interior.Color = RGB(255, 255, 0)
        Else
    End If
    
End Sub

and the call from the module

Code:
Sub basehit()    Worksheets("Score").Range("N2").Copy
    ActiveSheet.Paste
    Application.CutCopyMode = False
    
    Call Sheet1.ChangeColor
End Sub

I'm getting an runtime error 1004: Application defined or object defined error. What did I miss? BTW, it is in the same coding window as the curinning sub.

Ok, changed this
Code:
[COLOR=#333333]If Range("F13:T21" = "N2") Then[/COLOR]
to this
Code:
If Range("F13:T21").Value = Range("N2").Value Then
and now getting a Run Time error 13: Type mismatch
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

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