I've got text in column B. I'm using a condition that if the text in Column B is "TEST", then I'm moving the existing data in column E&F to columns M&N, respectively and clearing the source cells. It works if my range is small. But when I expand the range, it does not do anything and does not return an error. Is the range to large? I'm basically looking through all of column B which ranges from B2:B15000 but for the case here, I'm only searching through B2:B4000 and it still does nothing. Smaller range like scanning 100 cells works with no issue.
For example, if it finds "TEST" in cells B2, B55 and B56, then this happens to the existing data:
E2 gets moved to M2: E2 contents is cleared: F2 gets moved to N2: F2 contents is cleared:
E55 get moved to M55: E55 contents in cleared: F55 gets moved to N55: F55 contents is cleared:
E56 get moved to M56: E56 contents in cleared: F56 gets moved to N56: F56 contents is cleared:
Sub MoveIt2()
If Range("B2:B4000").Cells(i, 1).Value = "TEST" Then
With ActiveSheet
.Range("E2:E4000").Copy
.Range("M2:M4000").Insert Shift:=xlToRight
.Range("E2:E4000").ClearContents
.Range("F2:F4000").Copy
.Range("N2:N4000").Insert Shift:=xlToRight
.Range("F2:F4000").ClearContents
End With
End If
Application.CutCopyMode = False
End Sub