hi there,
It's late and I can't think anymore.
I am trying to look for a keyword in Sheet1 Column A and if found, I need it to copy that row and paste it into a table in Sheet2.
The problem is it keeps pasting it outside the table in sheet 2. I'm wondering if someone can help me troubleshoot why.
So what it is doing is, if I have 2 rows in Sheet 2 (row 1 being the header row and row 2 the first row of the table), it pastes it into Row 3 which isn't a part of the table. I need it to paste into row 2.
Here is the code:
Code
Sub Testmacro1()
Dim c As Range
Dim Source As Worksheet
Dim Dest As Worksheet
Set Source = ActiveWorkbook.Worksheets("SourceSht")
Set Dest = ActiveWorkbook.Worksheets("DestSht")
For Each c In Source.Range("A1:A" & Source.Cells(Rows.Count, 1).End(xlUp).Row)
If c = "Header" Then
c.EntireRow.Copy
Dest.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
End If
Next c
Application.CutCopyMode = False
End Sub
Display More
Also, is there a way to only get it to copy Column B and not the entire row?
Thanks in advance,
CS