LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Count statement with several contingencies

ActiveCell.Formula = "=count(" & Countbegin & ":" & Countend & ")"

HTH

"markose" wrote:


Hi, I am trying to assign two different cell addresses to two different
variables based on several differnt contingencies. I then want to pass
these variables in a formula (count formula). In the code below I want
to pass countbegin and countend as arguments in the count formula. I
want countbegin and countend to be the addresses of specific cells
based on some criteria. Here is the code I have been trying to work
with:

Range("b2").Select

If ActiveCell.Offset(0, -1) = "CONTROL" Then

'Range("ActiveCell.Select").Select
'Set Countbegin = Range("ActiveCell.Select")


Countbegin = Selection.Address


Do

If ActiveCell.Offset(1, -1) = "" Then


ActiveCell.Offset(1, 0).Select


ElseIf ActiveCell.Offset(1, -1) = "Begin #" Then


'Selection.End("ActiveCell.Select").Select


Countend = ActiveCell.Address


Exit Do


End If


Loop

ActiveCell.Offset(0, 15).Select

ActiveCell.Formula = "=count(Countbegin:Countend)"

End If




'ActiveCell.Formula = "=Count(Selection)"


'Count_answer = application.count(Countbegin:Countend)



End Sub



Thanks!


--
markose
------------------------------------------------------------------------
markose's Profile: http://www.excelforum.com/member.php...o&userid=31501
View this thread: http://www.excelforum.com/showthread...hreadid=511762


 
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
COUNT A YES STATEMENT AGAINST A NAME Dave Excel Discussion (Misc queries) 4 July 9th 09 02:14 PM
Count if statement frankb Excel Worksheet Functions 3 March 11th 09 12:28 PM
If & Count Statement Chris Excel Worksheet Functions 8 August 9th 08 11:21 PM
A week of dates and counting them using the COUNTIF function with contingencies j razz Excel Worksheet Functions 8 March 22nd 07 12:19 AM
life contingencies sylphide Excel Worksheet Functions 1 February 2nd 06 01:51 PM


All times are GMT +1. The time now is 10:47 AM.

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"