NeelsBorstlap
New Member
- Joined
- Jul 23, 2010
- Messages
- 25
Hi - I am using the this code to copy multiple books data in to a single book and not to "re-copy" data with the same date that is already in the single book.
It woks 100% and fast BUT it stop working when the data in the single book get more than 10,000 rows.
Is there someone that can help me with code that will do the same but not with the 10,000 row limit.
It woks 100% and fast BUT it stop working when the data in the single book get more than 10,000 rows.
Is there someone that can help me with code that will do the same but not with the 10,000 row limit.
Code:
Option Explicit
Sub ExtarctFromMultipleBooks()
Dim LineCounter As Integer
Dim CurrentBook As String
Dim LastDate As Date
Dim LastRow As Long
Dim LastRowMaster As Long
Dim Branch As String
For LineCounter = 3 To 18
With ThisWorkbook
LastRowMaster = .Worksheets("Master").Range("A65536").End(xlUp).Row
With .Worksheets("Sheet2")
CurrentBook = Trim(.Range("b" & LineCounter).Value)
Branch = .Range("c" & LineCounter).Value
LastDate = .Range("d" & LineCounter).Value
End With
End With
On Error GoTo NoSuchBook
With Workbooks(CurrentBook & ".xls").Worksheets("sheet1")
LastRow = .Range("A65536").End(xlUp).Row
.Columns("A:D").AutoFilter Field:=2, Criteria1:=">" & Format(LastDate, "mm/dd/yy"), Operator:=xlAnd
If .Range("A65536").End(xlUp).Row = 1 Then
MsgBox ("No New Data Found in " & CurrentBook)
Else
.Range("A2:IN" & LastRow).SpecialCells(xlCellTypeVisible).Copy ThisWorkbook.Worksheets("master").Range("A" & LastRowMaster + 1)
.ShowAllData
End If
End With
Next LineCounter
Exit Sub
NoSuchBook:
MsgBox (CurrentBook & " is not open or spelt incorrectly - macro cancelled")
End Sub