Excel VBA perfoming different in two computers same hardware configuration

J

japper70

Hi,

I have a problem with a VBA macro that copies a spreadsheet from on
workbook to another. This workbooks are more than 25 MB sizes each one
The first workbook perfome some analysis and the results are copied t
another woorkbook that compiles allthe results. The spreadshhet that i
being copied has a size of around 1 MB.

And runs the following code:


-Dim Analysis_date As Variant

Dim hoja, celda As String
File1 = Range("M2").Value
File2 = Range("M3").Value
Windows(File2).Activate
celda = Range("P2").Value
Group = Range("P3").Value
Totcities = Range("r2").Value
If Group = 1 Then
If Totcities < 29 Then
N = Totcities
Else
N = 30
End If
grp1 = 2
grp2 = 0

Else
N = Totcities + 1
grp1 = 31
grp2 = 29

End If

Sheets("TOTAL").Select
Windows(File1).Activate

Sheets("Investment Cost").Select
Capex_Type = Range("V79").Value
'N = Range("Av2").Value
'N = 22 '48
For i = grp1 To N '31
hoja = "Sheet" & i - grp2 '29

Windows(File1).Activate

Sheets("Investment Cost").Select
Range(celda).Select
ActiveCell.Offset(i, 0).Range("A1").Select
Selection.Copy
Range("j5").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Calculate
Analysis_date = Range("j10").Value

Sheets("Lo format").Select
Cells.Select
"Selection.Copy" *Here is the problem, the macro stop here fo
three minutes*
Windows(File2).Activate
Sheets(hoja).Select
Range("A1").Select

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
SkipBlanks _
:=False, Transpose:=False

Next
Sheets("Total").Select
Range("A1").Select
Range("Q1").Value = Capex_Type
Application.ScreenUpdating = True
Calculate
End Sub-

The problem is that in the second "selection.copy", from one machine t
another the difference in time goes from 10 second to three minutes
this makes that the whole process takes in total from 5 minutes to
1/2 hour. I'm using the same hardware in both computers, I believ
that it can be a configuration of memory or something similar, but I d
not kown where to look, and what should i be reviewing.


Can some one help me?

Best Regards Jappe
 
S

Simon Lloyd

This may sound like a daft question, but are you running the sam
version of Excel on both machines?, I had a similar problem when usin
a workbook and code created on an XP Excel 2003 and then ran it on a
XP Excel 97, on the 97 what took 3 minutes previously took 20 minutes.

Simo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top