PC Review


Reply
Thread Tools Rate Thread

CountIf cell value greater than 14

 
 
=?Utf-8?B?TGVz?=
Guest
Posts: n/a
 
      20th Nov 2007
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
 
Reply With Quote
 
 
 
 
Niek Otten
Guest
Posts: n/a
 
      20th Nov 2007
Hi Les,

Use

Application.Countif(Range"Q3

etc
"Les" <(E-Mail Removed)> wrote in message news:6E18A151-0B78-4F11-ABE7-(E-Mail Removed)...
| 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


 
Reply With Quote
 
Frederik
Guest
Posts: n/a
 
      20th Nov 2007
Since CountIf is a worksheet function, you have to preceed it with

Application.Worksheetfunction.CountIf(etcetera


greetings

"Les" <(E-Mail Removed)> schreef in bericht
news:6E18A151-0B78-4F11-ABE7-(E-Mail Removed)...
> 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



 
Reply With Quote
 
=?Utf-8?B?TGVz?=
Guest
Posts: n/a
 
      20th Nov 2007
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" <(E-Mail Removed)> wrote in message news:6E18A151-0B78-4F11-ABE7-(E-Mail Removed)...
> | 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
>
>
>

 
Reply With Quote
 
Niek Otten
Guest
Posts: n/a
 
      20th Nov 2007
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" <(E-Mail Removed)> wrote in message news:2F083F65-B256-4AFE-865B-(E-Mail Removed)...
| 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" <(E-Mail Removed)> wrote in message news:6E18A151-0B78-4F11-ABE7-(E-Mail Removed)...
| > | 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
| >
| >
| >


 
Reply With Quote
 
=?Utf-8?B?TGVz?=
Guest
Posts: n/a
 
      20th Nov 2007
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" <(E-Mail Removed)> wrote in message news:2F083F65-B256-4AFE-865B-(E-Mail Removed)...
> | 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" <(E-Mail Removed)> wrote in message news:6E18A151-0B78-4F11-ABE7-(E-Mail Removed)...
> | > | 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
> | >
> | >
> | >
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTIF greater than one column and less than another Nadine Microsoft Excel Worksheet Functions 5 8th May 2009 07:10 PM
Countif using less than or greater than criteria Kim B. Microsoft Excel Discussion 3 12th Mar 2008 05:30 PM
CountIf Greater Than/Find Greater Than Sisilla Microsoft Excel Programming 12 6th Oct 2006 08:04 PM
countif greater/less than argument =?Utf-8?B?bm1lIzE=?= Microsoft Excel Worksheet Functions 3 18th Oct 2005 07:36 AM
Countif cell greater than average =?Utf-8?B?TWFyeSBBbm4=?= Microsoft Excel Worksheet Functions 4 10th Aug 2005 09:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:59 AM.