I am trying to make this work, but it says Type mismatch
. Any help on what I am doing wrong? (I am very new to this)
Sub Copy_paste_XP()
Dim wsI As Worksheet
Dim aCell As Range, rngCopyFrom As Range, rng As Range
Dim lRow As Long
Set wsI = ThisWorkbook.Sheets("Move containers XP")
Set rng = ("E2:E500")
For Each aCell In rng
If Len(Trim(aCell.Value)) <> 0 Then
If rngCopyFrom Is Nothing Then
Set rngCopyFrom = aCell
Else
Set rngCopyFrom = Union(rngCopyFrom, aCell)
End If
End If
Next
If Not rngCopyFrom Is Nothing Then rngCopyFrom.Copy
Range("K2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = ("F2:F500")
For Each aCell In rng
If Len(Trim(aCell.Value)) <> 0 Then
If rngCopyFrom Is Nothing Then
Set rngCopyFrom = aCell
Else
Set rngCopyFrom = Union(rngCopyFrom, aCell)
End If
End If
Next
If Not rngCopyFrom Is Nothing Then rngCopyFrom.Copy
Range("K501").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub