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: 2
Default Excel VBA process increases exponentially with more records toprocess

I have the following code running to create a mail merge file. The
Users sheet contains all the contact information. The FreeAccess sheet
contains the users' IDs and the contents for the mail merge fields.
There could be as many as 30 rows per user on this sheet. The code
searches for all the rows for each user on the Users sheet and copies
the contents of each row of the FreeAccess sheets for that user to the
user's single row on the Users sheet. The problem I'm running into is
that I can run 250 records in about 15 minutes. It will run 500
records in an hour and 1000 records in 4 hours. At this point it's
quicker for me to run these in batches of 250. Is there something I
can do to stop this exponential increase in processing time so that I
can run larger batches more efficiently?

Dim lngUserRow As Long
Dim lngAccessRow As Long
Dim lngcolumn As Long
Dim lngKOU As Long
Dim lngMaxColumn As Long
Dim lngBrokerCount As Long
Dim StrHeading As String
Dim lngUserCount As Long
Dim lngAccessCount As Long
Dim n As Long
Dim lngNewMaxColumn As Long
Dim LastRow As Long
Dim strBroker As String

'Get count of users with request responses.

Worksheets("Users").Activate
If Cells(3, 1) = "" Then
lngUserCount = 1
Else: Cells(2, 1).Select
Range(Selection, Selection.End(xlDown)).Select
lngUserCount = Selection.Count
End If

' Get count of accessible brokers.
Worksheets("Free Access").Activate
Cells(2, 1).Select
Range(Selection, Selection.End(xlDown)).Select
lngAccessCount = Selection.Count


'Get accessible brokers and match them up with the users on the Users
worksheet (in one row).

Worksheets("Free Access").Activate
Cells(2, 1).Select
Selection.End(xlDown).Select
LastRow = ActiveCell.Row

lngMaxColumn = 6
lngUserRow = 2

For lngUserRow = 2 To LastRow

Worksheets("Users").Activate
lngcolumn = 7
lngKOU = Cells(lngUserRow, 1).Value

For lngAccessRow = 2 To lngAccessCount + 1

Worksheets("Free Access").Activate

If Cells(lngAccessRow, 1).Value = lngKOU Then

strBroker = Cells(lngAccessRow, 2).Value
Worksheets("Users").Activate
Cells(lngUserRow, lngcolumn).Value = strBroker
lngcolumn = lngcolumn + 1

If lngcolumn lngMaxColumn Then

lngMaxColumn = lngcolumn

End If

End If

If IsEmpty(Cells(3, 1)) Then
GoTo FINISH_HERE
End If

Next lngAccessRow

Next lngUserRow
 
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
File size growing growing exponentially Steve Excel Discussion (Misc queries) 3 May 24th 09 06:29 PM
Excel file size increases when editing same info Ron Bevan Excel Discussion (Misc queries) 3 July 25th 06 03:53 PM
How to count process running time ( process not finished) miao jie Excel Programming 0 January 13th 05 09:23 AM
How to count process running time ( process not finished) miao jie Excel Programming 2 January 12th 05 06:01 AM
small GIF massively increases excel file size Newsgroupuser765 Excel Programming 0 September 20th 03 08:14 AM


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