I have a huge macro and it Works fine except for this part of the code I do not know why it takes so much time (other calculations are similar or even bigger)
b -> is number of rows of this sheet
a -> is the number of times it has to move (this number comes from another sheet)
I am sure that there are multiple ways to improve this. (I already have screeupdating and calculation at manual)
For x = 1 To b
Range("Z1").Select
ActiveCell.Offset(x, 0).Select
For i = 1 To (a - 1)
If ActiveCell.Value <> 0 Then
d = Sheets("AGREGADO").Range("a1048576").End(xlUp).Row
Sheets("AGREGADO").Cells(d + 1, 1).Value = Sheets("TODO").Cells(x + 1, 7).Value
Sheets("AGREGADO").Cells(d + 1, 3).Value = Sheets("TODO").Cells(x + 1, 25 + i).Value
Sheets("AGREGADO").Cells(d + 1, 2).Value = Sheets("TODO").Cells(1, 25 + i).Value
Sheets("AGREGADO").Cells(d + 1, 4).Value = Sheets("TODO").Cells(x + 1, 32 + a).Value
End If
ActiveCell.Offset(0, 1).Select
Next i
Next x
Thanks in advance!