![]() |
CountIf cell value greater than 14
Hello all,
I have the code below and it is not working ? I get a compile error: Sub or function not defined and COUNTIF is highlited ? Any help woud be appreciated Sub testToC() ' Dim poDelay As Variant, lstCell As Long lstCell = Cells(Rows.Count, "A").End(xlUp).Row poDelay = CountIf("Q3:Q" & lstCell, "14") End Sub -- Les |
CountIf cell value greater than 14
Hi Les,
Use Application.Countif(Range"Q3 etc "Les" wrote in message ... | Hello all, | | I have the code below and it is not working ? | | I get a compile error: Sub or function not defined and COUNTIF is highlited ? | | Any help woud be appreciated | | Sub testToC() | ' | Dim poDelay As Variant, lstCell As Long | | lstCell = Cells(Rows.Count, "A").End(xlUp).Row | poDelay = CountIf("Q3:Q" & lstCell, "14") | | End Sub | | -- | Les |
CountIf cell value greater than 14
Since CountIf is a worksheet function, you have to preceed it with
Application.Worksheetfunction.CountIf(etcetera greetings "Les" schreef in bericht ... Hello all, I have the code below and it is not working ? I get a compile error: Sub or function not defined and COUNTIF is highlited ? Any help woud be appreciated Sub testToC() ' Dim poDelay As Variant, lstCell As Long lstCell = Cells(Rows.Count, "A").End(xlUp).Row poDelay = CountIf("Q3:Q" & lstCell, "14") End Sub -- Les |
CountIf cell value greater than 14
Hi Niek,
Thank you for your reply, that works but the variable gives me an error:2015 ? -- Les "Niek Otten" wrote: Hi Les, Use Application.Countif(Range"Q3 etc "Les" wrote in message ... | Hello all, | | I have the code below and it is not working ? | | I get a compile error: Sub or function not defined and COUNTIF is highlited ? | | Any help woud be appreciated | | Sub testToC() | ' | Dim poDelay As Variant, lstCell As Long | | lstCell = Cells(Rows.Count, "A").End(xlUp).Row | poDelay = CountIf("Q3:Q" & lstCell, "14") | | End Sub | | -- | Les |
CountIf cell value greater than 14
This seems to work, although I don't have your data
Sub testToC() ' Dim poDelay As Variant, lstCell As Long lstCell = Cells(Rows.Count, "A").End(xlUp).Row poDelay = Application.CountIf(Range("Q3:Q" & lstCell), "14") End Sub -- Kind regards, Niek Otten Microsoft MVP - Excel "Les" wrote in message ... | Hi Niek, | | Thank you for your reply, that works but the variable gives me an error:2015 ? | | -- | Les | | | "Niek Otten" wrote: | | Hi Les, | | Use | | Application.Countif(Range"Q3 | | etc | "Les" wrote in message ... | | Hello all, | | | | I have the code below and it is not working ? | | | | I get a compile error: Sub or function not defined and COUNTIF is highlited ? | | | | Any help woud be appreciated | | | | Sub testToC() | | ' | | Dim poDelay As Variant, lstCell As Long | | | | lstCell = Cells(Rows.Count, "A").End(xlUp).Row | | poDelay = CountIf("Q3:Q" & lstCell, "14") | | | | End Sub | | | | -- | | Les | | | |
CountIf cell value greater than 14
That cracked it thanks very much... ;-0)
-- Les "Niek Otten" wrote: This seems to work, although I don't have your data Sub testToC() ' Dim poDelay As Variant, lstCell As Long lstCell = Cells(Rows.Count, "A").End(xlUp).Row poDelay = Application.CountIf(Range("Q3:Q" & lstCell), "14") End Sub -- Kind regards, Niek Otten Microsoft MVP - Excel "Les" wrote in message ... | Hi Niek, | | Thank you for your reply, that works but the variable gives me an error:2015 ? | | -- | Les | | | "Niek Otten" wrote: | | Hi Les, | | Use | | Application.Countif(Range"Q3 | | etc | "Les" wrote in message ... | | Hello all, | | | | I have the code below and it is not working ? | | | | I get a compile error: Sub or function not defined and COUNTIF is highlited ? | | | | Any help woud be appreciated | | | | Sub testToC() | | ' | | Dim poDelay As Variant, lstCell As Long | | | | lstCell = Cells(Rows.Count, "A").End(xlUp).Row | | poDelay = CountIf("Q3:Q" & lstCell, "14") | | | | End Sub | | | | -- | | Les | | | |
All times are GMT +1. The time now is 10:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com