LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mat Mat is offline
external usenet poster
 
Posts: 3
Default Improving code.....For Next

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
 
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
Improving the Discussion Boards Jeremy Excel Discussion (Misc queries) 1 February 12th 08 09:34 PM
Improving formula Brad Excel Worksheet Functions 1 April 6th 06 06:02 PM
Improving use of Worksheets TKeune Excel Worksheet Functions 2 February 11th 06 10:59 AM
Improving speed with VBA Steven Cheng[_2_] Excel Programming 7 October 12th 03 05:37 PM
need help in improving this macro mcm Excel Programming 0 August 28th 03 04:32 AM


All times are GMT +1. The time now is 03:23 AM.

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"