Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 91
Default count rows in a column for looping

I was using this code

RwsCnt = ActiveSheet.UsedRange.Rows.Count
for i = 1 to RwsCnt

'Code

Next i

it works correctly but the value of the row count increases as the
macro goes along

how can I get this to count just the rows in column B?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default count rows in a column for looping

For i = 1 To Cells(Rows.Count, 2).End(xlUp).Row
--
Gary''s Student - gsnu200714


"damorrison" wrote:

I was using this code

RwsCnt = ActiveSheet.UsedRange.Rows.Count
for i = 1 to RwsCnt

'Code

Next i

it works correctly but the value of the row count increases as the
macro goes along

how can I get this to count just the rows in column B?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 91
Default count rows in a column for looping

On Apr 8, 2:48 pm, Gary''s Student
wrote:
For i = 1 To Cells(Rows.Count, 2).End(xlUp).Row
--
Gary''s Student - gsnu200714

"damorrison" wrote:
I was using this code


RwsCnt = ActiveSheet.UsedRange.Rows.Count
for i = 1 to RwsCnt


'Code


Next i


it works correctly but the value of the row count increases as the
macro goes along


how can I get this to count just the rows in column B?


Great ,
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
looping through rows and columns mattguerilla Excel Discussion (Misc queries) 1 March 20th 07 05:14 PM
Count the number of rows where more than one column meets set crit BarrieVoice Excel Worksheet Functions 2 July 14th 06 07:25 PM
Looping a selection of rows Andre Kruger Excel Discussion (Misc queries) 1 December 15th 05 04:18 PM
Count rows that match criteria in 2 different column cell ranges JoAnn New Users to Excel 2 December 9th 05 05:51 PM
Looping until empty column theguz Excel Discussion (Misc queries) 1 August 4th 05 07:04 PM


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