Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Using the Lastrow variable in a Count/Countif formula

Here's what I'm trying to do:

1. Find the lastrow with data in it:

bb = Cells(Rows.Count, "B").End(xlUp).Row (OK)

2. Next use variable bb as part of a COUNT formula in cell D1:

Range("D1").Formula = "=COUNT("M" & 5 & ":M" & bb)"

The error I receive is:

Compile error -- expected End of Statement

Please help

Thanks
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Using the Lastrow variable in a Count/Countif formula

John

try: Range("D1").Formula = "=COUNT(""M5:M"" & bb)"

Regards

Trevor


"John" wrote in message
m...
Here's what I'm trying to do:

1. Find the lastrow with data in it:

bb = Cells(Rows.Count, "B").End(xlUp).Row (OK)

2. Next use variable bb as part of a COUNT formula in cell D1:

Range("D1").Formula = "=COUNT("M" & 5 & ":M" & bb)"

The error I receive is:

Compile error -- expected End of Statement

Please help

Thanks
John



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Using the Lastrow variable in a Count/Countif formula

maybe:

Range("D1").Formula = "=COUNT(""M5:M" & bb & """)"
'or
Range("D1").Formula = "=COUNT(""M" & 5 & ":M" & bb & """)"

Trevor Shuttleworth wrote:

John

try: Range("D1").Formula = "=COUNT(""M5:M"" & bb)"

Regards

revor

"John" wrote in message
m...
Here's what I'm trying to do:

1. Find the lastrow with data in it:

bb = Cells(Rows.Count, "B").End(xlUp).Row (OK)

2. Next use variable bb as part of a COUNT formula in cell D1:

Range("D1").Formula = "=COUNT("M" & 5 & ":M" & bb)"

The error I receive is:

Compile error -- expected End of Statement

Please help

Thanks
John


--

Dave Peterson

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
More than one variable for Countif Carrie_Loos via OfficeKB.com Excel Worksheet Functions 14 May 5th 09 07:57 AM
Count with 1 variable & 1 constant criteria formula Excel-User-RR Excel Worksheet Functions 3 February 3rd 09 05:54 PM
countif using two variable Memphus01 Excel Discussion (Misc queries) 8 December 9th 08 07:37 PM
Formula format for Count or Countif funtion with two criterias Debi Excel Worksheet Functions 2 September 26th 05 08:23 PM
Go to lastrow using other column's lastrow stakar[_14_] Excel Programming 5 April 16th 04 03:42 PM


All times are GMT +1. The time now is 10:09 PM.

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"