![]() |
Please help with code
Hi all again,
Tom Ogilvy gave me this code and it works great but I need it to insert into sheet2 without replacing the data already there. How do I get it to do this. Sub CopyData() Dim rng as Range, cell as Range, col as Long Dim rw as Long, rng2 as Range col = 3 rw = 2 With Worksheets("sheet1") set rng = .range(.cells(2,col),.cells(rows.count,col).End(xl up)) End with for each cell in rng if lcase(cell.value) = "yes" then cell.EntireRow.copy Destination:=worksheets("sheet2") _ .cells(rw,1) rw = rw + 1 if rng2 is nothing then set rng2 = cell else set rng2 = union(rng2,cell) end if end if Next if not rng2 is nothing then rng2.EntireRow.Delete End if End Sub Thanks in advance Greg |
Please help with code
I worked it out thanks
Greg |
All times are GMT +1. The time now is 04:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com