Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Using "Countif" in macro gives compile error

Hi to all,

I dont know why following line of code in my macro is giving a compile
error

Single line Code

currency_check = Application.WorksheetFunction.COUNTIF(N:N,"<GBP") -
Application.WorksheetFunction.COUNTIF(N:N,"<"&"*" )

<<<Single line Code

I have declared it as
Dim currency_check As Integer

But the compiler objects at ":" (n:n) part of function and says that,"
Expected List Seperator or )"

Kindly advice.

With Regards,

Ashish

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Using "Countif" in macro gives compile error

You have to pass a range to it, not an Excel cell reference

currency_check =
Application.WorksheetFunction.COUNTIF(Range("N:N") ,"""<GBP""") -
Application.WorksheetFunction.COUNTIF(Range("N:N") ,"""<*""")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ashish128" wrote in message
ups.com...
Hi to all,

I dont know why following line of code in my macro is giving a compile
error

Single line Code

currency_check = Application.WorksheetFunction.COUNTIF(N:N,"<GBP") -
Application.WorksheetFunction.COUNTIF(N:N,"<"&"*" )

<<<Single line Code

I have declared it as
Dim currency_check As Integer

But the compiler objects at ":" (n:n) part of function and says that,"
Expected List Seperator or )"

Kindly advice.

With Regards,

Ashish



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Using "Countif" in macro gives compile error

Try this:-

currency_check = Application.WorksheetFunction.CountIf(Range("N:N") ,
"<GBP") - Application.WorksheetFunction.CountIf(Range("N:N") , "<" & "*")

Mike


"ashish128" wrote:

Hi to all,

I dont know why following line of code in my macro is giving a compile
error

Single line Code

currency_check = Application.WorksheetFunction.COUNTIF(N:N,"<GBP") -
Application.WorksheetFunction.COUNTIF(N:N,"<"&"*" )

<<<Single line Code

I have declared it as
Dim currency_check As Integer

But the compiler objects at ":" (n:n) part of function and says that,"
Expected List Seperator or )"

Kindly advice.

With Regards,

Ashish


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Using "Countif" in macro gives compile error

On Jun 15, 3:43 pm, "Bob Phillips" wrote:
You have to pass a range to it, not an Excel cell reference

currency_check =
Application.WorksheetFunction.COUNTIF(Range("N:N") ,"""<GBP""") -
Application.WorksheetFunction.COUNTIF(Range("N:N") ,"""<*""")

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ashish128" wrote in message

ups.com...



Hi to all,


I dont know why following line of code in my macro is giving a compile
error


Single line Code


currency_check = Application.WorksheetFunction.COUNTIF(N:N,"<GBP") -
Application.WorksheetFunction.COUNTIF(N:N,"<"&"*" )


<<<Single line Code


I have declared it as
Dim currency_check As Integer


But the compiler objects at ":" (n:n) part of function and says that,"
Expected List Seperator or )"


Kindly advice.


With Regards,


Ashish- Hide quoted text -


- Show quoted text -


Thanks Friend, It worked

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Using "Countif" in macro gives compile error

On Jun 15, 3:51 pm, Mike H wrote:
Try this:-

currency_check = Application.WorksheetFunction.CountIf(Range("N:N") ,
"<GBP") - Application.WorksheetFunction.CountIf(Range("N:N") , "<" & "*")

Mike



"ashish128" wrote:
Hi to all,


I dont know why following line of code in my macro is giving a compile
error


Single line Code


currency_check = Application.WorksheetFunction.COUNTIF(N:N,"<GBP") -
Application.WorksheetFunction.COUNTIF(N:N,"<"&"*" )


<<<Single line Code


I have declared it as
Dim currency_check As Integer


But the compiler objects at ":" (n:n) part of function and says that,"
Expected List Seperator or )"


Kindly advice.


With Regards,


Ashish- Hide quoted text -


- Show quoted text -


Thanks Friend, It worked

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
Macro Error "Unable to record" Gary Excel Worksheet Functions 0 December 5th 06 05:24 PM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
"Compile error: sub or function not defined" Joe Excel Discussion (Misc queries) 4 January 30th 06 08:19 PM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" QTP Professional Excel Discussion (Misc queries) 1 November 18th 05 11:47 PM


All times are GMT +1. The time now is 12:22 AM.

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

About Us

"It's about Microsoft Excel"