Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trying to add a row after the last value and count

I have a collumn with several matching values sorted. i.e. e4-e10 all =
6, e11-e20 all = 5, etc. The number of values will vary. I want to find
the last "6" and add a row below it and then count the number of 6's in
that range and so on and so on.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Trying to add a row after the last value and count

Dim cell as Range, CurVal as Long, CurCount as Long, LastRow as Long, I as
Long
CurVal = Range("E4").Value
CurCount = 1
LastRow = Range("E65536").End(xlUp).Row
For I = 5 to LastRow Step 1
If CurVal = Range("E" & I).Value Then
CurCount = CurCount + 1
Else
CurVal = Range("E" & I)
Range(I & ":" & I).Insert
I = I + 1
LastRow = LastRow + 1
Range("E" & I).Value = CurCount
CurCount = 0
End If
Next I

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"TRexSuz" wrote in message
...
I have a collumn with several matching values sorted. i.e. e4-e10 all =
6, e11-e20 all = 5, etc. The number of values will vary. I want to find
the last "6" and add a row below it and then count the number of 6's in
that range and so on and so on.



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
Multiple Criteria, Count If, Sum Product to get count across range Jonathan Excel Worksheet Functions 5 January 9th 08 11:32 PM
Count Employee Work Time - Don't Double-count Overlapping Apts. J Excel Worksheet Functions 0 April 27th 07 05:52 AM
Excel 2000, count, sort a list & count totals? sunslight Excel Worksheet Functions 1 April 9th 07 05:46 PM
Count Intervals of 2 Consecutive Values in same Row and Return Count across Row Sam via OfficeKB.com Excel Worksheet Functions 6 November 29th 05 03:27 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM


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

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"