PC Review


Reply
Thread Tools Rate Thread

countif in VB

 
 
mohavv
Guest
Posts: n/a
 
      31st Mar 2008
Hi,

Can this be done shorter, without using cell B1

Range("B1").Formula = "=COUNTIF(A:A,""*Stock*"")"
Stock = Range("B1").Value
Range("B1").Clear

Cheers,

Harold
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      31st Mar 2008
Dim Stock As Long
Stock = Application.CountIf(ActiveSheet.Range("a:a"), "*stock*")
MsgBox Stock


mohavv wrote:
>
> Hi,
>
> Can this be done shorter, without using cell B1
>
> Range("B1").Formula = "=COUNTIF(A:A,""*Stock*"")"
> Stock = Range("B1").Value
> Range("B1").Clear
>
> Cheers,
>
> Harold


--

Dave Peterson
 
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 is Off by 1 GooseMA Microsoft Excel Misc 4 8th Dec 2009 05:04 PM
Can I use COUNTIF with OR? AA Arens Microsoft Excel Discussion 3 20th Nov 2006 04:11 PM
How do I use a countif function according to two other countif fu. =?Utf-8?B?S2lyc3R5?= Microsoft Excel Worksheet Functions 2 20th Feb 2006 11:44 AM
COUNTIF or not to COUNTIF on a range in another sheet =?Utf-8?B?RWxsaWU=?= Microsoft Excel Worksheet Functions 4 15th Sep 2005 10:06 PM
COUNTIF in one colum then COUNTIF in another...??? =?Utf-8?B?Sm9ubmllUA==?= Microsoft Excel Worksheet Functions 3 22nd Feb 2005 02:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:04 PM.