• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to copy B cell if not null and A in front of it as well


New Member
Need your help for this code :

>>> use code - tags <<<
Sub Copy()

Dim i As Integer
'Dim j As Integer
j = Worksheets("sheet1").Columns("B").Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows, LookIn:=xlValues).Row

For i = 2 To j

If Cells(i, 2) = "" Or Cells(i, 2) = 0 Then

Sheet1.Range("A1").End(xlDown).Offset(1, 0).Value = Sheet2.Range("A" & i).Value
Sheet1.Range("B1").End(xlDown).Offset(1, 0).Value = Sheet2.Range("B" & i).Value

End If

Next i

End Sub
Attched file have 2 coulmns so if B cell in sheet1 is not null then copy B cell and A cell in fornt of it in sheet2
Kindly your help

Thank You


Last edited by a moderator: