Thread: [Solved] Loop - Row increment
View Single Post
 
Old 04-16-2015, 09:13 AM
jrt jrt is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Nov 2014
Posts: 2
jrt is on a distinguished road
Default Loop - Row increment

Hi,

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.

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

Thank You.
Reply With Quote