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: 4
Default Custom VBA took 0.0625 sec is it too slow?

Hi
I have abt 220 rows and 25 columns to fill up with this function
and i tested the speed abt 0.0625 sec which means it takes up to 5.5min to
run finish the whole thing
Anyway to make it faster ?

i have a table consist of 5 impt fields (PO#,PartNo,POQty,DueDate,POBalQty)
My Function call in 2 values(PartNo and EDate)
EDate = a Monday

I need to display whether during the week i have
- how many dely Or
- how many POQty Or
- how many dely and POBal

Anyway to make it faster ?

Function calQty(PartNo As String, EDate)

Dim PO, Bal, Dely, POtemp, Baltemp, Delytemp

Worksheets("PO").Activate
NextRow = Application.WorksheetFunction.CountA(Worksheets("P O").Range("A:A"))
PO = 0
Bal = 0
Dely = 0
POtemp = 0
Baltemp = 0
Delytemp = 0

For A = 1 To NextRow
If Worksheets("PO").Cells(A, 3) = PartNo And Worksheets("PO").Cells(A,
6) < EDate + 7 And Worksheets("PO").Cells(A, 6) = EDate Then
x = A
If Worksheets("PO").Cells(x, 10) = 0 Then
Delytemp = Worksheets("PO").Cells(x, 5)
Dely = Dely + Delytemp
ElseIf Worksheets("PO").Cells(x, 10) = Worksheets("PO").Cells(x,
5) Then
POtemp = Worksheets("PO").Cells(x, 5)
PO = PO + POtemp
Else
Baltemp = Worksheets("PO").Cells(x, 10)
Bal = Bal + Baltemp
End If
End If
Next A

Bal = Bal + PO

If Bal = 0 Then
calQty = "D " & Dely
ElseIf Dely = 0 Then
calQty = PO
Else
calQty = "D " & Dely & " B " & Bal
End If

If Bal = 0 And Dely = 0 Then
calQty = 0
End If
End Function
 
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
Custom View show is very slow Spencer Hutton Excel Discussion (Misc queries) 0 September 16th 09 04:37 PM
how do i show a zero in front of a number ie 0625 in excel George Excel Discussion (Misc queries) 2 October 20th 07 04:46 AM
Slow Excel Navigation with Up / Down Arrow and slow scrolling deddog Excel Discussion (Misc queries) 0 August 14th 07 09:56 PM
Adding custom list and text boxes to the custom tool bar from Excel C API Mousam Excel Discussion (Misc queries) 0 August 7th 07 09:19 AM
Can you link a custom property to an Excel custom header text? LouErc Setting up and Configuration of Excel 0 November 8th 05 04:58 PM


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