Hi guys
I have the following code that runs only in debug mode but returns a type mismatch error..
EndRow = Sheets("Data_Main").Range("D" & Rows.Count).End(xlUp).Row
c1 = 2
For k = 2 To EndRow
If (Sheets("Data_Main").Range("D" & k) = Range("A1")) Then
Range("I" & c1) = Sheets("Data_Main").Range("A" & k)
c1 = c1 + 1
End If
Next k
A very similar snippet of code (in the same project) runs perfectly fine outside of break mode.. I'm really puzzled. I know that DataMain is a large dataset (40000) rows or so. Could that possibly lead to this kind of error?
EndRow = Sheets("Territory_Rules").Range("A" & Rows.Count).End(xlUp).Row
c1 = 2
For k = 2 To EndRow
If (Sheets("Territory_Rules").Range("A" & k) = Range("A1")) Then
Range("A" & c1) = Sheets("Territory_Rules").Range("B" & k)
Range("B" & c1) = Sheets("Territory_Rules").Range("C" & k)
Range("C" & c1) = Sheets("Territory_Rules").Range("D" & k)
c1 = c1 + 1
End If
Next k
Bookmarks