FILE 2 SLOW

  • Thread starter Thread starter jzamilpa3
  • Start date Start date
J

jzamilpa3

the excel file im working on performs code too slow. it tak emore than
30min to upload and update everything. is there anything i can do to
make it perform a little faster

heres the code im using:

For a = 2 To 2000
strBlah = Sheet5.Cells(a, 6)
Sheet10.Cells(g, 1) = strBlah
Sheet10.Cells(g, 2) = Sheet5.Cells(a, 14)
Sheet10.Cells(g, 3) = Sheet5.Cells(a, 3) & " " & Sheet5.Cells(a,
8) & " " & Sheet5.Cells(a, 10) & " Phn#:" & Sheet5.Cells(a, 11)
Sheet10.Cells(g, 4) = Sheet5.Cells(a, 16)
g = g + 1
Next a

Application.ScreenUpdating = True
 
I did not see if you turned your calculator to manual.

Application.Calculation = x1CalculationManual

' code
Application.Calculation = x1CalculationAutomatic
 
I did not see if you turned your calculator to manual.

Application.Calculation = x1CalculationManual

' code
Application.Calculation = x1CalculationAutomatic








- Show quoted text -

WHICH ONE SHOULD I USE, NOT EXACTLY SURE WHAT IT MEANS
 
Use the first one at the start of your code Application.Calculation =
x1CalculationManual
This way any calculations will not occur until the program runs. This
typically causes programs to run slow as Excel will do whatever calculations
on the sheets then returns to the program.

Then before you end your program turn the calculator back on with
Application.Calculation = x1CalculationAutomatic
 
FORSOME REASON ITS NOT WORKING CORRECTLY
IT GIVE ME AN ERROR

here the full code i have on there

Private Sub cmdImport_Click()
Dim j, a, b, g As Integer
Dim strBlah As String

'Application.ScreenUpdating = False
Application.Calculation = x1CalculationManual = False


Sheet12.Range("A9:C2000").Select
Selection.Clear
Selection.WrapText = True

g = 9 'starting row

'For j = 3 To 1000000
'If Sheet2.Cells(j, 1) = "" Then
'j = j + 1
'GoTo 1
'End If
'Next j
'1:

For a = 2 To 2000
strBlah = Sheet2.Cells(a, 6)
Sheet12.Cells(g, 1) = strBlah
Sheet12.Cells(g, 2) = Sheet2.Cells(a, 14)
Sheet12.Cells(g, 3) = Sheet2.Cells(a, 3) & " " & Sheet2.Cells(a,
8) & " " & Sheet2.Cells(a, 10) & " Phn#:" & Sheet2.Cells(a, 11)
Sheet12.Cells(g, 4) = Sheet2.Cells(a, 16)
g = g + 1
Next a

Application.Calculation = x1CalculationAutomatic = True
'Application.ScreenUpdating = True

End Sub
 
What type of error is it?


FORSOME REASON ITS NOT WORKING CORRECTLY
IT GIVE ME AN ERROR

here the full code i have on there

Private Sub cmdImport_Click()
Dim j, a, b, g As Integer
Dim strBlah As String

'Application.ScreenUpdating = False
Application.Calculation = x1CalculationManual = False


Sheet12.Range("A9:C2000").Select
Selection.Clear
Selection.WrapText = True

g = 9 'starting row

'For j = 3 To 1000000
'If Sheet2.Cells(j, 1) = "" Then
'j = j + 1
'GoTo 1
'End If
'Next j
'1:

For a = 2 To 2000
strBlah = Sheet2.Cells(a, 6)
Sheet12.Cells(g, 1) = strBlah
Sheet12.Cells(g, 2) = Sheet2.Cells(a, 14)
Sheet12.Cells(g, 3) = Sheet2.Cells(a, 3) & " " & Sheet2.Cells(a,
8) & " " & Sheet2.Cells(a, 10) & " Phn#:" & Sheet2.Cells(a, 11)
Sheet12.Cells(g, 4) = Sheet2.Cells(a, 16)
g = g + 1
Next a

Application.Calculation = x1CalculationAutomatic = True
'Application.ScreenUpdating = True

End Sub
 
Change this line:
Application.Calculation = x1CalculationManual = False
to
Application.Calculation = xlCalculationManual
(remove the "= False" and change x1 (x-one) to XL (x-ell))

And same with this line:
Application.Calculation = x1CalculationAutomatic = True
becomes:
Application.Calculation = xlCalculationAutomatic
 
OMG that worked perfect. thank u so much. what did u use to learn
more? i would like to learn alot more.
 
Back
Top