Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Programming lag..

Hello,

I have a list of employees on a schedule. I have a piece of code look
them up, sort them by start time, and then put them on a daily line up for
printing.. Problem is that it takes a long time on the work PC's (200mhz).
The problem seems to be after the array returns sorted. I cannot seem to
figure it out. Any ideas?

Thanks...

Sub Sunday(week)

Dim TheArray(60, 3) As Variant
Dim a, c, e, R
Dim Lunch, After, Dinner, Late As Boolean

a = 0

Range("A9:C49").ClearContents

' Create a new progress bar
Set sb = New clsProgressBar

' Display the progress bar
sb.Show constWait, vbNullString, 0

' Create the array.

For Each c In Range(week)

a = a + 1

TheArray(a, 1) = c.Value
TheArray(a, 2) = c.Cells(1, 2).Value
TheArray(a, 3) = c.Cells(1, -1).Value

Next

' Sort the Array and display the values in order.

BubbleSort TheArray

'Lag seems to start here...
R = 10

For a = 1 To UBound(TheArray)

e = TheArray(a, 1)

If e = "" Then GoTo Bottom
If Application.WorksheetFunction.IsText(e) = True Then GoTo Bottom

If Lunch = False Then
If e = 0.458 Then
R = R + 1
Lunch = True
End If
End If

If After = False Then
If e = 0.58 Then
R = R + 7
After = True
End If
End If

If Dinner = False Then
If e = 0.708 Then
R = R + 1
Dinner = True
End If
End If

If Late = False Then
If e = 0.833 Then
R = R + 1
Late = True
End If
End If

Range("A" & R).Value = TheArray(a, 1)
Range("B" & R).Value = TheArray(a, 2)
Range("C" & R).Value = TheArray(a, 3)

R = R + 1

Bottom:
sb.PercentComplete = (a / 60) * 100
Next

End Sub


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
programming help biker man Excel Discussion (Misc queries) 2 July 22nd 07 11:54 PM
CD Programming nelson Excel Discussion (Misc queries) 0 June 4th 06 04:32 PM
programming ernie Excel Discussion (Misc queries) 4 March 13th 06 02:06 PM
Programming help BB Excel Discussion (Misc queries) 3 December 5th 05 01:09 AM
How to add via programming ? Milind Excel Programming 3 September 10th 03 11:57 PM


All times are GMT +1. The time now is 01:09 PM.

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"