• 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

    Hui...

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

Loop_Row increment

jagadeesh.rt

New Member
Can any please.......ASAP..
increment row number using variable
If the data is available in the rst, the result should add to the existing data and increase rows by pasting the result


Code works :
sheet lst values (column A) mapped with sheet checks value (column I) - IF MATCHED, range should be copied from A:O and the result should pasted in rst sheet name (as same copied without any changes).

If data available : find the last row and add to the existing data.

Below code working fine : up to pastespecial....

my request : increment row number using variable
If the data is available in the rst, the result should add to the existing data and increase rows by pasting the result

Code:
Sub test3()
    Dim x As Integer, y
      Dim s As Integer, j
        x = Sheets("lst").Range("a" & Rows.Count).End(xlUp).Row
        s = Sheets("checks").Range("I" & Rows.Count).End(xlUp).Row
        a = 1
            For y = 1 To x
              For j = 1 To s
                If Sheets("lst").Cells(y, 1) = Sheets("checks").Cells(j, 9) Then
                a = a + 1
                    Sheets("checks").Range("A" & j & ":O" & j).Copy
                    Sheets("rst").Range("A1").PasteSpecial
                End If
              Next j
            Next y
End Sub

Please find the attachment for sample workbook.

Thank You.
 

Attachments

  • lst_row increment.xlsm
    152.9 KB · Views: 2
Hi NARAYANK991,

Code worked fine. Thank You.

Can u please clarify this line once....regarding vbNullString

Code:
If Sheets("Checks").Cells(j, 9) <> vbNullString Then
 
Back
Top