LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Is ther a better way?


Is there a better way to achieve the same result that doesn't take s
long. I let this run for 10 minutes before stopping it. I changed th
LastRow to = 50 and it ran fine so I know it works. Normally whe
running this there will be between 2000 and 10000 rows to loop through
I know when looping through that many rows it's going to take some tim
but if 2000 rows takes longer than 10 minutes then this won't work wel
for me.

Ok, This is seeing if 2 rows in columns A match then 2 rows in column
C match then 2 rows in columns D match. If all are true then add 1 t
previous rows value. if its not true then put a 1 in the cell.
I'm basically counting the number of times columns A, C, and D matc
with previous row then starting the count over.



Code
-------------------
Dim counter As Integer
LastRow = Range("A65532").End(xlUp).Row
counter = 2
Do Until counter = LastRow + 1
If Range("A" & counter) = Range("A" & counter - 1) And Range("D" & counter) = Range("D" & counter - 1) And Range("C" & counter) = Range("C" & counter - 1) Then
Range("G" & counter) = Range("G" & counter - 1).Value + 1
Else
Range("G" & counter) = 1
End If
counter = counter + 1
Loo
-------------------

--
BN-C
-----------------------------------------------------------------------
BN-CD's Profile: http://www.excelforum.com/member.php...fo&userid=3537
View this thread: http://www.excelforum.com/showthread.php?threadid=57081

 
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
Why is ther no "Convert" function available in excel? EXCEL CONVERT FUNCTION Excel Worksheet Functions 2 August 2nd 06 09:19 PM
excel, can put name in one cell and get ther# in the next cell? jesse Excel Worksheet Functions 1 June 15th 06 01:40 AM
Is ther a way to change the interior.colorindex of multiple rows sdnicsm Excel Programming 2 April 5th 04 03:53 AM


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