Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please help with code
I worked it out thanks
Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
stubborn Excel crash when editing code with code, one solution | Excel Programming | |||
option buttons run Click code when value is changed via VBA code | Excel Programming |