M
Mat
I would like to improve this code where I take 5 rows and when done
move to the other account which is different.
Thx
Mat
'Loop for Positive
For b = 2 To 5000
lastrow = ActiveCell.Offset(5, 0).Row
Do Until b = lastrow
Cells(b, 7).Select
Range(Cells(b, 7), Cells(b, 10)).Select
Selection.Copy
Windows("RPACSTAR.XLS").Activate
Sheets("OUTPUT").Select
Range("A5000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Windows("RPX.XLS").Activate
b = b + 1
Loop
Exit For
Next b
For c = b To 2000
If Cells(c, 7) <> Cells(c + 1, 7) Or Cells(c, 8) <> Cells(c + 1, 8)
Then
Cells(c + 1, 7).Select
Exit For
End If
Next c
For d = c + 1 To 2000
lastrow = ActiveCell.Offset(5, 0).Row
Do Until d = lastrow
Cells(d, 7).Select
Range(Cells(d, 7), Cells(d, 10)).Select
Selection.Copy
Windows("RPACSTAR.XLS").Activate
Sheets("OUTPUT").Select
Range("A5000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Windows("RPX.XLS").Activate
d = d + 1
Loop
Exit For
Next d
For e = d To 2000
If Cells(e, 7) <> Cells(e + 1, 7) Or Cells(e, 8) <> Cells(e + 1, 8)
Then
Cells(e + 1, 7).Select
Exit For
End If
Next e
move to the other account which is different.
Thx
Mat
'Loop for Positive
For b = 2 To 5000
lastrow = ActiveCell.Offset(5, 0).Row
Do Until b = lastrow
Cells(b, 7).Select
Range(Cells(b, 7), Cells(b, 10)).Select
Selection.Copy
Windows("RPACSTAR.XLS").Activate
Sheets("OUTPUT").Select
Range("A5000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Windows("RPX.XLS").Activate
b = b + 1
Loop
Exit For
Next b
For c = b To 2000
If Cells(c, 7) <> Cells(c + 1, 7) Or Cells(c, 8) <> Cells(c + 1, 8)
Then
Cells(c + 1, 7).Select
Exit For
End If
Next c
For d = c + 1 To 2000
lastrow = ActiveCell.Offset(5, 0).Row
Do Until d = lastrow
Cells(d, 7).Select
Range(Cells(d, 7), Cells(d, 10)).Select
Selection.Copy
Windows("RPACSTAR.XLS").Activate
Sheets("OUTPUT").Select
Range("A5000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Windows("RPX.XLS").Activate
d = d + 1
Loop
Exit For
Next d
For e = d To 2000
If Cells(e, 7) <> Cells(e + 1, 7) Or Cells(e, 8) <> Cells(e + 1, 8)
Then
Cells(e + 1, 7).Select
Exit For
End If
Next e