ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   countif usage in macro (https://www.excelbanter.com/new-users-excel/70318-countif-usage-macro.html)

parthaemail

countif usage in macro
 

if i give the function =countif(sheet1!E2:E12,"=Europe") in blank
shell of excel ,it gives no of rows having the word europe in the
column E . but if i give the same commend in macro it shows syntax
error .


Sub parthamacro()
'
' parthamacro Macro
' Macro recorded 2/8/2006 by 128304
'

'
Dim nResult As Long
nResult = sheet1.countif(sheet1!E2:E12,"=Europe")

End Sub


can you please help me , how to use countif function in macros


--
parthaemail
------------------------------------------------------------------------
parthaemail's Profile: http://www.excelforum.com/member.php...o&userid=31311
View this thread: http://www.excelforum.com/showthread...hreadid=510077


Don Guillett

countif usage in macro
 
You can help yourself by looking at the vba help index or answer for
worksheet functions.

--
Don Guillett
SalesAid Software

"parthaemail"
wrote in message
...

if i give the function =countif(sheet1!E2:E12,"=Europe") in blank
shell of excel ,it gives no of rows having the word europe in the
column E . but if i give the same commend in macro it shows syntax
error .


Sub parthamacro()
'
' parthamacro Macro
' Macro recorded 2/8/2006 by 128304
'

'
Dim nResult As Long
nResult = sheet1.countif(sheet1!E2:E12,"=Europe")

End Sub


can you please help me , how to use countif function in macros


--
parthaemail
------------------------------------------------------------------------
parthaemail's Profile:
http://www.excelforum.com/member.php...o&userid=31311
View this thread: http://www.excelforum.com/showthread...hreadid=510077




Dave Peterson

countif usage in macro
 
Dim myRng as range
dim nResult as long
set myrng = worksheets("sheet1").range("e2:E12")
nresult = application.countif(myrng,"europe")




parthaemail wrote:

if i give the function =countif(sheet1!E2:E12,"=Europe") in blank
shell of excel ,it gives no of rows having the word europe in the
column E . but if i give the same commend in macro it shows syntax
error .

Sub parthamacro()
'
' parthamacro Macro
' Macro recorded 2/8/2006 by 128304
'

'
Dim nResult As Long
nResult = sheet1.countif(sheet1!E2:E12,"=Europe")

End Sub

can you please help me , how to use countif function in macros

--
parthaemail
------------------------------------------------------------------------
parthaemail's Profile: http://www.excelforum.com/member.php...o&userid=31311
View this thread: http://www.excelforum.com/showthread...hreadid=510077


--

Dave Peterson


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com