I have code to place items from one apreadsheet to another. It has worked for a couple of years. Now it doesn't pick up any rows beyon 3689. I have a table with 4000 rows and 21 columns. the code moves only 3 of the columns from "MASTER" to "COMPLIANCE" by row based on a date and an if then .
Is there an error in the Code? and why would it stop at that row?
Here is the code.
Sub MoveItCOMPLIANCE()
Application.ScreenUpdating = False
Sheets("COMPLIANCE").Select
Range("B3:L7000").Select
Selection.ClearContents
Range("B3").Select
Sheets("Master").Select
Dim Lastrow As Long, r As Integer, c As Integer
Lastrow = Sheets("Master").Range("A65536").End(xlUp).Row
For r = 1 To Lastrow
'FIRST IF ID THE DATE
'SECOND IF IS THE BLANK APPT CELL
If Sheets("Master").Cells(r, 5) = Range("A1") Then
If Sheets("Master").Cells(r, 8) = Sheets("Master").Cells(r, 10) Then
Sheets("COMPLIANCE").Cells(r, 3) = Sheets("Master").Cells(r, 7).Value
Sheets("COMPLIANCE").Cells(r, 4) = Sheets("Master").Cells(r, 3).Value
Sheets("COMPLIANCE").Cells(r, 2) = Sheets("Master").Cells(r, 2).Value
End If
End If
Next r
Sheets("COMPLIANCE").Select
Range("B3:L20000").Select
ActiveWindow.ScrollRow = 1
Selection.Sort Key1:=Range("B3"), Order1:=xlAscending, Key2:=Range("D3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("C2").Select
End Sub
Bookmarks