Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
copy and paste according to cell value
I'm looking for a macro that whenever I type "y" in "O" column it copy
corresponding cells from B:N to sheet 2 starting from B:5 and look for another "y" in col. O and paste it below what it pasted before in sheet 2. thx. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200801/1 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
copy and paste according to cell value
I found this macro, but the problem is that it copies duplicates. for example
if I type "y" in column O5 and run the macro and then type "y" in O6 it will copy previous row which is O5 again. Any idea how to make it not to copy the previous row again? Option Explicit Sub testme() Dim myCell As Range Dim myRng As Range Dim destCell As Range With Worksheets("Daily") Set myRng = .Range("O5:O92") End With For Each myCell In myRng.Cells If LCase(myCell.Value) = "y" Then With Worksheets("Funnel") Set destCell = .Cells(.Rows.Count, "B").End(xlUp).Offset(1, 0) End With Range(myCell.Offset(0, -1), myCell.Offset(0, -13)).Copy _ Destination:=destCell End If Next myCell End Sub saman110 wrote: I'm looking for a macro that whenever I type "y" in "O" column it copy corresponding cells from B:N to sheet 2 starting from B:5 and look for another "y" in col. O and paste it below what it pasted before in sheet 2. thx. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200801/1 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
copy and paste according to cell value
How about changing that Y to some other character after it's copied to the other
sheet. Option Explicit Sub testme() Dim myCell As Range Dim myRng As Range Dim destCell As Range With Worksheets("Daily") Set myRng = .Range("O5:O92") End With For Each myCell In myRng.Cells If LCase(myCell.Value) = "y" Then With Worksheets("Funnel") Set destCell = .Cells(.Rows.Count, "B").End(xlUp).Offset(1, 0) End With myrng.parent.Range(myCell.Offset(0, -1), myCell.Offset(0, -13)).Copy _ Destination:=destCell mycell.value = "Copied" 'or just C???? End If Next myCell End Sub "saman110 via OfficeKB.com" wrote: I found this macro, but the problem is that it copies duplicates. for example if I type "y" in column O5 and run the macro and then type "y" in O6 it will copy previous row which is O5 again. Any idea how to make it not to copy the previous row again? Option Explicit Sub testme() Dim myCell As Range Dim myRng As Range Dim destCell As Range With Worksheets("Daily") Set myRng = .Range("O5:O92") End With For Each myCell In myRng.Cells If LCase(myCell.Value) = "y" Then With Worksheets("Funnel") Set destCell = .Cells(.Rows.Count, "B").End(xlUp).Offset(1, 0) End With Range(myCell.Offset(0, -1), myCell.Offset(0, -13)).Copy _ Destination:=destCell End If Next myCell End Sub saman110 wrote: I'm looking for a macro that whenever I type "y" in "O" column it copy corresponding cells from B:N to sheet 2 starting from B:5 and look for another "y" in col. O and paste it below what it pasted before in sheet 2. thx. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200801/1 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell | Excel Worksheet Functions | |||
Want to use a Macro to copy and paste cell *value* only | Excel Discussion (Misc queries) | |||
how do i copy n paste one cell to another in different worksheets | Excel Worksheet Functions | |||
Copy/Paste from once cell to another | Excel Worksheet Functions | |||
Select cell, Copy it, Paste it, Return to Previous cell | Excel Discussion (Misc queries) |