ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   application.worksheetfunction. <function (syntax) (https://www.excelbanter.com/excel-programming/308672-application-worksheetfunction-function-syntax.html)

Peter[_21_]

application.worksheetfunction. <function (syntax)
 
Dear all,

What would be the correct syntaxis if wanted to use the outcome of the
worksheetfunction countif in a range that goes from b2 to b2000 on a sheet
named "X" and the outcome should contain the number of cells that contain
the value 212.

I think it would look a little like this

MyValue = Application.WorksheetFunction.CountIf( range , "*212*" ).

Simply recording a macro that places the countif-function directly into a
cell with all arguments required for my goal does not work.

Thanks for your help

Peter



Chip Pearson

application.worksheetfunction. <function (syntax)
 
Peter,

Try something like

MyValue = Application.WorksheetFunction.CountIf( _
Worksheets("X").Range("B2:B2000"),"*212*")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Peter" wrote in message
...
Dear all,

What would be the correct syntaxis if wanted to use the outcome

of the
worksheetfunction countif in a range that goes from b2 to b2000

on a sheet
named "X" and the outcome should contain the number of cells

that contain
the value 212.

I think it would look a little like this

MyValue = Application.WorksheetFunction.CountIf( range ,

"*212*" ).

Simply recording a macro that places the countif-function

directly into a
cell with all arguments required for my goal does not work.

Thanks for your help

Peter





Peter[_21_]

application.worksheetfunction. <function (syntax)
 
Thanks for the tip, Chip. Unfortunately I get the error Expected: Expression
when I try this.

Peter


"Chip Pearson" schreef in bericht
...
Peter,

Try something like

MyValue = Application.WorksheetFunction.CountIf( _
Worksheets("X").Range("B2:B2000"),"*212*")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Peter" wrote in message
...
Dear all,

What would be the correct syntaxis if wanted to use the outcome

of the
worksheetfunction countif in a range that goes from b2 to b2000

on a sheet
named "X" and the outcome should contain the number of cells

that contain
the value 212.

I think it would look a little like this

MyValue = Application.WorksheetFunction.CountIf( range ,

"*212*" ).

Simply recording a macro that places the countif-function

directly into a
cell with all arguments required for my goal does not work.

Thanks for your help

Peter







Peter[_21_]

application.worksheetfunction. <function (syntax)
 
I'm a liar, I just applied it the wrong way. How can an answer from Chip
Pearson possibly not work ?

Sorry


"Peter" schreef in bericht
...
Thanks for the tip, Chip. Unfortunately I get the error Expected:

Expression
when I try this.

Peter


"Chip Pearson" schreef in bericht
...
Peter,

Try something like

MyValue = Application.WorksheetFunction.CountIf( _
Worksheets("X").Range("B2:B2000"),"*212*")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Peter" wrote in message
...
Dear all,

What would be the correct syntaxis if wanted to use the outcome

of the
worksheetfunction countif in a range that goes from b2 to b2000

on a sheet
named "X" and the outcome should contain the number of cells

that contain
the value 212.

I think it would look a little like this

MyValue = Application.WorksheetFunction.CountIf( range ,

"*212*" ).

Simply recording a macro that places the countif-function

directly into a
cell with all arguments required for my goal does not work.

Thanks for your help

Peter










All times are GMT +1. The time now is 01:25 PM.

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