Hi, I'm trying to use arrays to speed up my macro. It currently copies the data I need over to "DEST" as expected. I'd like to combine arrays and then copy and paste once to speed up the process.
Below is my code - it loops through the source book "SRCE" - starting at A8 - and pastes in the next empty cell in "DEST" starting at C6
Below is my code - it loops through the source book "SRCE" - starting at A8 - and pastes in the next empty cell in "DEST" starting at C6
VBA Code:
Sub CopyPasteArrays()
Application.ScreenUpdating = False
Sheets("SRCE").Select
Dim i As Long
Dim y As Integer
Dim myArray As Variant
y = 6
For i = 8 To 100 'source data always starts at row 8 but varies in length
If Range("A" & i) = "End" Then 'End signifies the end of data
Exit Sub
Else
If Range("A" & i) = "condition 1" Or Range("A" & i) = "condition 2" Then
Sheets("DEST").Range("C" & y).Value = Range("A" & i).Value
y = y + 1
Else: GoTo Skip
End If
End If
Skip:
Next i
Application.ScreenUpdating = True
End Sub