Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Count If Range?

Hi All

Having a hard time with the following

Private Sub Add1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Customers")
Worksheets("Customers").Select

Tb1.Value = Application.CountIf(Range("J3:J600"), "35") <<<< Working ok

What I need is

Tb1.Value = Application.CountIf(Range("J3:J600") ' ws("Prices") Range ("A2")
so that if I change the price from "35" to 40 in ("A2")("Prices") it will
count the "40" in the "Customers" sheet.

Is this possible please - over 2 hours down the line and still no further
forward.
--
Many thanks

hazel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Count If Range?

Hazel,

Try

Tb1 = Application.WorksheetFunction.CountIf(Range("J1:J1 00"),
Sheets("Prices").Range("A1").Value)

"Hazel" wrote:

Hi All

Having a hard time with the following

Private Sub Add1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Customers")
Worksheets("Customers").Select

Tb1.Value = Application.CountIf(Range("J3:J600"), "35") <<<< Working ok

What I need is

Tb1.Value = Application.CountIf(Range("J3:J600") ' ws("Prices") Range ("A2")
so that if I change the price from "35" to 40 in ("A2")("Prices") it will
count the "40" in the "Customers" sheet.

Is this possible please - over 2 hours down the line and still no further
forward.
--
Many thanks

hazel

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Count If Range?

Tb1.Value = Application.CountIf(Range("J3:J600"),ws("Prices"). Range ("A2")
..Value)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Hazel" wrote in message
...
Hi All

Having a hard time with the following

Private Sub Add1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Customers")
Worksheets("Customers").Select

Tb1.Value = Application.CountIf(Range("J3:J600"), "35") <<<< Working ok

What I need is

Tb1.Value = Application.CountIf(Range("J3:J600") ' ws("Prices") Range
("A2")
so that if I change the price from "35" to 40 in ("A2")("Prices") it will
count the "40" in the "Customers" sheet.

Is this possible please - over 2 hours down the line and still no further
forward.
--
Many thanks

hazel



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Count If Range?

typo

Tb1.Value = Application.CountIf(Range("J3:J600"),Worksheets("P rices").Range
("A2") .Value)


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Bob Phillips" wrote in message
...
Tb1.Value = Application.CountIf(Range("J3:J600"),ws("Prices"). Range ("A2")
.Value)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Hazel" wrote in message
...
Hi All

Having a hard time with the following

Private Sub Add1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Customers")
Worksheets("Customers").Select

Tb1.Value = Application.CountIf(Range("J3:J600"), "35") <<<< Working ok

What I need is

Tb1.Value = Application.CountIf(Range("J3:J600") ' ws("Prices") Range
("A2")
so that if I change the price from "35" to 40 in ("A2")("Prices") it will
count the "40" in the "Customers" sheet.

Is this possible please - over 2 hours down the line and still no further
forward.
--
Many thanks

hazel





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Count If Range?

Hi Mike & Bob

As usual, I come back from Lunch and my problems are solved -- thanks to you
both. Going to try and get the label now to read the Prices ("A2") and then
the jobs done
--
Many thanks

hazel


"Mike H" wrote:

Hazel,

Try

Tb1 = Application.WorksheetFunction.CountIf(Range("J1:J1 00"),
Sheets("Prices").Range("A1").Value)

"Hazel" wrote:

Hi All

Having a hard time with the following

Private Sub Add1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Customers")
Worksheets("Customers").Select

Tb1.Value = Application.CountIf(Range("J3:J600"), "35") <<<< Working ok

What I need is

Tb1.Value = Application.CountIf(Range("J3:J600") ' ws("Prices") Range ("A2")
so that if I change the price from "35" to 40 in ("A2")("Prices") it will
count the "40" in the "Customers" sheet.

Is this possible please - over 2 hours down the line and still no further
forward.
--
Many thanks

hazel

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
Count Vaules in a range that appear in another range T Newbery Excel Worksheet Functions 5 February 11th 10 05:08 PM
Multiple Criteria, Count If, Sum Product to get count across range Jonathan Excel Worksheet Functions 5 January 9th 08 11:32 PM
count with a range [email protected] Excel Programming 6 February 23rd 06 02:53 PM
How to count dates within a certain range in a column with mutiple date range entries Krisjhn Excel Worksheet Functions 2 September 1st 05 01:59 PM
Count cells in one range based on parameters in another range dave roth Excel Worksheet Functions 2 March 29th 05 05:33 PM


All times are GMT +1. The time now is 02:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"