Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
VK VK is offline
external usenet poster
 
Posts: 12
Default How do I specify certain column to count rows in it?

Hi, all!
There is an option in Excel to count all used rows in active sheet:
ActiveSheet.UsedRange.Rows.Count

I would like to count rows in one column, that is shorter then other.
How do I specify certain column to count? Something like:

Columns("M:M").UsedRange.Rows.Count

Reg. VK
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default How do I specify certain column to count rows in it?

this will find the last cell in col M with data
Sub countm()
MsgBox Cells(Rows.Count, "M").End(xlUp).Row
End Sub

--
Don Guillett
SalesAid Software

"VK" wrote in message
...
Hi, all!
There is an option in Excel to count all used rows in active sheet:
ActiveSheet.UsedRange.Rows.Count

I would like to count rows in one column, that is shorter then other.
How do I specify certain column to count? Something like:

Columns("M:M").UsedRange.Rows.Count

Reg. VK



  #3   Report Post  
Posted to microsoft.public.excel.programming
VK VK is offline
external usenet poster
 
Posts: 12
Default How do I specify certain column to count rows in it?

Don Guillett wrote:
this will find the last cell in col M with data
Sub countm()
MsgBox Cells(Rows.Count, "M").End(xlUp).Row
End Sub


That is! Thanks! Is it possible to count rows in column with active
autofilter?
Reg, VK
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default How do I specify certain column to count rows in it?

Have a look at the SUBTOTAL function using the count parameter

--
Don Guillett
SalesAid Software

"VK" wrote in message
...
Don Guillett wrote:
this will find the last cell in col M with data
Sub countm()
MsgBox Cells(Rows.Count, "M").End(xlUp).Row
End Sub


That is! Thanks! Is it possible to count rows in column with active
autofilter?
Reg, VK



  #5   Report Post  
Posted to microsoft.public.excel.programming
VK VK is offline
external usenet poster
 
Posts: 12
Default How do I specify certain column to count rows in it?

Don Guillett wrote:
Have a look at the SUBTOTAL function using the count parameter


Thanks, again! It works!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default How do I specify certain column to count rows in it?

glad to help

--
Don Guillett
SalesAid Software

"VK" wrote in message
...
Don Guillett wrote:
Have a look at the SUBTOTAL function using the count parameter


Thanks, again! It works!



  #7   Report Post  
Posted to microsoft.public.excel.programming
VK VK is offline
external usenet poster
 
Posts: 12
Default How do I specify certain column to count rows in it?

Don Guillett wrote:
Have a look at the SUBTOTAL function using the count parameter

I overseen, that I'm using
m = Cells(Rows.Count, "I").End(xlUp).Row
Cells(m + 2, 9).Formula = "=Subtotal(9,I2:I94)"

I would like instead of I2:I94

m = Cells(Rows.Count, "I").End(xlUp).Row
Cells(m + 2, 9).Formula = "=Subtotal(9,Cells(2,9):Cells(m,9)"

Of course it doesn't work. How do I specify range in formula dynamically?
Reg, VK
  #8   Report Post  
Posted to microsoft.public.excel.programming
VK VK is offline
external usenet poster
 
Posts: 12
Default How do I specify certain column to count rows in it?

VK wrote:
Don Guillett wrote:

Have a look at the SUBTOTAL function using the count parameter

I overseen, that I'm using
m = Cells(Rows.Count, "I").End(xlUp).Row
Cells(m + 2, 9).Formula = "=Subtotal(9,I2:I94)"

I would like instead of I2:I94

m = Cells(Rows.Count, "I").End(xlUp).Row
Cells(m + 2, 9).Formula = "=Subtotal(9,Cells(2,9):Cells(m,9)"

Of course it doesn't work. How do I specify range in formula dynamically?
Reg, VK



Found:

Cells(m + 2, 9).Formula = "=Subtotal(9,I2:I" & m & ")"

;)
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 NonBlank Rows with Criteria in another column [email protected] Excel Worksheet Functions 7 May 9th 09 03:04 AM
Count all rows in column with data, Except rows 1-5 Gregory Day Excel Worksheet Functions 4 March 27th 08 02:58 PM
count rows in a column for looping damorrison Excel Discussion (Misc queries) 2 April 8th 07 10:30 PM
Rows Count of a particular column kaon[_24_] Excel Programming 2 August 2nd 04 12:20 PM
Rows Count of a particular column kaon[_23_] Excel Programming 2 August 2nd 04 02:57 AM


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