Link to home
Start Free TrialLog in
Avatar of leezac
leezac

asked on

Copy Values VBA between two sheets

I am needing to copy data from Sheet1 to Sheet2 if Sheet1 column P is True.  The code below finds True but does not copy the values...  Can someone please take a look at the code.  I am also needing to paste the values on Sheet2 on the last empty row.
Thank you.  


Dim sh1 As Worksheet: Set sh1 = ThisWorkbook.Sheets("Master")
Dim sh2 As Worksheet: Set sh2 = ThisWorkbook.Sheets("Validation")
Dim RowSh1 As Long, RowSh2 As Long

RowSh1 = sh1.Range("A" & Rows.Count).End(xlUp).Row + 1
RowSh2 = sh2.Range("A" & Rows.Count).End(xlUp).Row

For x = 1 To RowSh1

    If Len(sh1.Cells(x, "P")) = True Then
       
        sh1.Cells(x, "A").Copy sh2.Cells(RowSh2, "B")
       
        sh1.Cells(x, "C").Copy sh2.Cells(RowSh2, "A")
       
     
   
        RowSh2 = RowSh2 + 1
       
    End If

Next x

End Sub
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

What actual value do you use in column P to show that it's True?
ASKER CERTIFIED SOLUTION
Avatar of DOSLover
DOSLover
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial