When I run this code Im getting a run time error '1004': The info connat be pasted becuase the copy area and paste area are not the same size and shape. Here is my code, does anyone know a way to get around this error so it will copy properly?
Sub Table()
Application.ScreenUpdating = False
Dim j As Long
j = 15
Sheets("sheet2").Select
lastline = ActiveSheet.UsedRange.Rows.Count
For i = 1 To lastline
If Sheets("sheet2").Cells(i, 1) = Sheets("sheet1").Range("P8") And _
Sheets("sheet2").Cells(i, 3) = Sheets("sheet1").Range("Q8") And _
Sheets("sheet2").Cells(i, 4) = Sheets("sheet1").Range("R8") Then
tocopy = 1
Else
End If
If tocopy = 1 Then
Rows(i).Copy Destination:=Sheets("sheet1").Cells(j, 11)
j = j + 1
End If
tocopy = 0
Next i
Application.ScreenUpdating = True
If Sheets("sheet1").Cells(2, 1) = 0 Then MsgBox ("Table selection does not exist.")
End Sub
Sub Table()
Application.ScreenUpdating = False
Dim j As Long
j = 15
Sheets("sheet2").Select
lastline = ActiveSheet.UsedRange.Rows.Count
For i = 1 To lastline
If Sheets("sheet2").Cells(i, 1) = Sheets("sheet1").Range("P8") And _
Sheets("sheet2").Cells(i, 3) = Sheets("sheet1").Range("Q8") And _
Sheets("sheet2").Cells(i, 4) = Sheets("sheet1").Range("R8") Then
tocopy = 1
Else
End If
If tocopy = 1 Then
Rows(i).Copy Destination:=Sheets("sheet1").Cells(j, 11)
j = j + 1
End If
tocopy = 0
Next i
Application.ScreenUpdating = True
If Sheets("sheet1").Cells(2, 1) = 0 Then MsgBox ("Table selection does not exist.")
End Sub