Hi, I have searched through the forums and found a macro that will search one column for a word, copy the row, and paste it onto a new worksheet:
This code works great, except if I run this macro again, it will re-copy and past what's already been copied right below where it was first pasted. I would like it where if new information was added to Sheet1 then it would just copy the new information and paste it onto Sheet2. Is this possible?
Another thing is, when it copies the rows, it pastes them in the same order on the new page, for example, if it copies rows 3 and 5, it'll post them on sheet2 in rows 3 and 5, and I would like it to post in rows 2 and 3.
Any help is greatly appreciated!
Code:
[COLOR=#333333][I]Sub COPYROW()[/I][/COLOR]
[COLOR=#333333][I]Dim rcnt As Long, result As Long[/I][/COLOR]
[COLOR=#333333][I]rcnt = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row[/I][/COLOR]
[COLOR=#333333][I]result = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row[/I][/COLOR]
[COLOR=#333333][I]For i = 2 To rcnt[/I][/COLOR]
[COLOR=#333333][I]If Sheets("Sheet1").Range("C" & i).Value = [/I][/COLOR][COLOR=red][I]"condition in col C"[/I][/COLOR][COLOR=#333333][I] Then[/I][/COLOR]
[COLOR=#333333][I]result = result + 1[/I][/COLOR]
[COLOR=#333333][I]Sheets("Sheet1").Rows(i & ":" & i).Copy (Sheets("Sheet2").Rows(result & ":" & result))[/I][/COLOR]
[COLOR=#333333][I]End If[/I][/COLOR]
[COLOR=#333333][I]Next[/I][/COLOR]
[COLOR=#333333][I]End Sub[/I][/COLOR]
This code works great, except if I run this macro again, it will re-copy and past what's already been copied right below where it was first pasted. I would like it where if new information was added to Sheet1 then it would just copy the new information and paste it onto Sheet2. Is this possible?
Another thing is, when it copies the rows, it pastes them in the same order on the new page, for example, if it copies rows 3 and 5, it'll post them on sheet2 in rows 3 and 5, and I would like it to post in rows 2 and 3.
Any help is greatly appreciated!