Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default variable range in a COUNTIF statment

The position of the cells which have the data I want to check, change
depending on certain criteria. Is it possible in VBA to create a flexible
COUNTIF statement, where the range is a range object or something similar?
What is the sintax? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default variable range in a COUNTIF statment

Dim rng as Range, cnt as Long
With Worksheets("sheet1")
set rng = .Range(.cells(5,1),.cells(5,1).End(xldown))
End With
cnt = Application.countif(rng,"AA")

--
Regards,
Tom Ogilvy


"Sabean" wrote:

The position of the cells which have the data I want to check, change
depending on certain criteria. Is it possible in VBA to create a flexible
COUNTIF statement, where the range is a range object or something similar?
What is the sintax? Thanks

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
using =COUNTIF() in a variable range on a different worksheet? circuit_breaker Excel Worksheet Functions 4 July 6th 09 07:56 PM
Using COUNTIF for multiple text data creating a logic statment Scott Excel Worksheet Functions 12 January 16th 08 12:18 AM
Using variable sized range in CountIf() [email protected][_2_] Excel Discussion (Misc queries) 1 October 24th 07 11:15 AM
variable range countif JK Excel Worksheet Functions 3 November 3rd 04 07:50 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM


All times are GMT +1. The time now is 01:52 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"