Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default 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
|
|
|




  #6   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default 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
|
|
|



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTIF greater than one column and less than another Nadine Excel Worksheet Functions 5 May 8th 09 07:10 PM
CountIf Greater Than/Find Greater Than Sisilla[_2_] Excel Programming 12 October 6th 06 08:04 PM
Excel to COUNTIF if number greater than one but less than another Rooster8 Excel Worksheet Functions 2 October 24th 05 10:35 PM
countif greater/less than argument nme#1 Excel Worksheet Functions 3 October 18th 05 07:36 AM
Countif cell greater than average Mary Ann Excel Worksheet Functions 4 August 10th 05 09:49 AM


All times are GMT +1. The time now is 03:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"