vba countif

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,104
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi All

trying to work out why the below will not give me my answer

Code:
Range("'app'!$C$4").Value = WorksheetFunction.CountIf(Worksheets("Meeting").Range("g2:g30"), ">1")

trying to make sheet "app" cell c4 = the count of cells in sheet "meeting" in range G2:g30 that are more than 1.

any ideas, i just get 0

much appriciated

dave
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You cannot use worksheet names inside of your range declaration. Try:
Code:
Sheets("app").Range("C4").Value = WorksheetFunction.CountIf(Worksheets("Meeting").Range("g2:g30"), ">1")
 
Upvote 0
Hi Joe

thanks, but still not working

Code:
Sheets("App").Range("C4").Value = WorksheetFunction.CountIf(Worksheets("Meeting").Range("G2:G30"), ">1")

but then i put the formula in the cell to check, and i had nothing >1, i had to use >"". The data is actually a string rather than a number derived from a formula
feel stupid now, thanks for the help

Dave
 
Upvote 0
but then i put the formula in the cell to check, and i had nothing >1, i had to use >"".
Well, of course it isn't going to work if you change the conditions it was originally based on!
trying to make sheet "app" cell c4 = the count of cells in sheet "meeting" in range G2:g30 that are more than 1.
Try:
Code:
Sheets("app").Range("C4").Value = WorksheetFunction.CountIf(Worksheets("Meeting").Range("g2:g30"), ">""")
 
Upvote 0
many thanks joe.

all working 100%

cheers

dave
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

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