Hi all,
I've got the following code, which copies data from other sheets within the same workbook. The idea is to place the data into one table, with the data from the next sheet going into the next empty cell etc etc.
Sub CopyPivot()
Dim cell As Range
Dim i As Long
i = Sheets("Shared Contact Pivot").Cells(Rows.Count, "B").End(xlUp).Row + 1
For Each cell In Sheets("CPA 1").Range("B2:D" & Sheets("CPA 1").Cells(Rows.Count, "B").End(xlUp).Row)
If cell.Value <> "" Then
Sheets("Shared Contact Pivot").Range("B" & i).Value = cell.Value
i = i + 1
End If
On Error Resume Next
Next cell
i = Sheets("Shared Contact Pivot").Cells(Rows.Count, "B").End(xlUp).Row + 1
For Each cell In Sheets("CPA 2").Range("B2:D" & Sheets("CPA 2").Cells(Rows.Count, "B").End(xlUp).Row)
If cell.Value <> "" Then
Sheets("Shared Contact Pivot").Range("B" & i).Value = cell.Value
i = i + 1
End If
On Error Resume Next
Next cell
End Sub
I've gone wrong somewhere, as it is copying it all into one column (B) as opposed to copying across B, C and D.
Any ideas?
Bookmarks