#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
If I understand you code, it looks like you select a variable range to copy from "checks", but your PasteSpecial is to the same range "A1" every time. I'm guessing, the range should be Range("A" & a).
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Increment Numbers | Darbsp | Word | 3 | 03-10-2015 05:25 AM |
macro not working (on click increment) | gsrikanth | Excel Programming | 1 | 07-12-2012 07:40 AM |
on click increment | gsrikanth | Excel Programming | 1 | 02-23-2012 08:19 AM |
Increment Numbers Help | Jazz43 | Word | 2 | 07-30-2010 02:48 AM |