Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy cell base on value in different cell
If I has column E = "a" & col F = "b" then copy cell in col A to col H in any
row have those value. Thanks in advance, CN |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy cell base on value in different cell
In H2 for example, put in a formula like
=if(and(E2="a",F2="b"),A2,"") then drag fill down the column. -- regards, Tom Ogilvy "CN" wrote in message ... If I has column E = "a" & col F = "b" then copy cell in col A to col H in any row have those value. Thanks in advance, CN |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy cell base on value in different cell
Hi Tom,
Thanks for reply this post, In H2 example, that mean for Row 2 only or they can be any row? Here some code I has put together, it work but not met all required I need, please help: Sub ButtonCopy() Range("F2:F20").Select Do Until ActiveCell = "" If ActiveCell = "" Then End ActiveCell.Select If ActiveCell = "a" Then ' right here I sould add another condition (E) in here With Selection.Interior ..ColorIndex = 6 ..Pattern = xlSolid ..PatternColorIndex = xlAutomatic End With End If ActiveCell.Offset(1, 0).Activate Loop Range("B2:B20").Select 'Here, I do not want to copy all in col B Selection.Font.ColorIndex = 9 Selection.Copy 'Paste results ActiveSheet.Paste Range("H2:H20").Select 'Here, I do not want to paste all in col H ActiveSheet.Paste Selection.Font.ColorIndex = 9 I am using range to copy and paste, but that not what I want, I just want to copy only if col E = 'a' and F = 'b' on all the row relate to this. Please help, thanks CN "Tom Ogilvy" wrote: In H2 for example, put in a formula like =if(and(E2="a",F2="b"),A2,"") then drag fill down the column. -- regards, Tom Ogilvy "CN" wrote in message ... If I has column E = "a" & col F = "b" then copy cell in col A to col H in any row have those value. Thanks in advance, CN |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy cell base on value in different cell
Sub ButtonCopy()
Dim cell as Range, rw as Long for each cell in Range("F2:F20") if isempty(cell) then exit sub rw = cell.row if lcase(cell.Value) = "a" and _ lcase(cells(rw,"E").Value) = "b" then cells(rw,"A").copy Destination:=cells(rw,"H") end if Next End sub -- Regards, Tom Ogilvy "CN" wrote in message ... Hi Tom, Thanks for reply this post, In H2 example, that mean for Row 2 only or they can be any row? Here some code I has put together, it work but not met all required I need, please help: Sub ButtonCopy() Range("F2:F20").Select Do Until ActiveCell = "" If ActiveCell = "" Then End ActiveCell.Select If ActiveCell = "a" Then ' right here I sould add another condition (E) in here With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid .PatternColorIndex = xlAutomatic End With End If ActiveCell.Offset(1, 0).Activate Loop Range("B2:B20").Select 'Here, I do not want to copy all in col B Selection.Font.ColorIndex = 9 Selection.Copy 'Paste results ActiveSheet.Paste Range("H2:H20").Select 'Here, I do not want to paste all in col H ActiveSheet.Paste Selection.Font.ColorIndex = 9 I am using range to copy and paste, but that not what I want, I just want to copy only if col E = 'a' and F = 'b' on all the row relate to this. Please help, thanks CN "Tom Ogilvy" wrote: In H2 for example, put in a formula like =if(and(E2="a",F2="b"),A2,"") then drag fill down the column. -- regards, Tom Ogilvy "CN" wrote in message ... If I has column E = "a" & col F = "b" then copy cell in col A to col H in any row have those value. Thanks in advance, CN |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to copy cell base on value in different cell
Thanks, it work very good.
Very appreciated. CN "Tom Ogilvy" wrote: Sub ButtonCopy() Dim cell as Range, rw as Long for each cell in Range("F2:F20") if isempty(cell) then exit sub rw = cell.row if lcase(cell.Value) = "a" and _ lcase(cells(rw,"E").Value) = "b" then cells(rw,"A").copy Destination:=cells(rw,"H") end if Next End sub -- Regards, Tom Ogilvy "CN" wrote in message ... Hi Tom, Thanks for reply this post, In H2 example, that mean for Row 2 only or they can be any row? Here some code I has put together, it work but not met all required I need, please help: Sub ButtonCopy() Range("F2:F20").Select Do Until ActiveCell = "" If ActiveCell = "" Then End ActiveCell.Select If ActiveCell = "a" Then ' right here I sould add another condition (E) in here With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid .PatternColorIndex = xlAutomatic End With End If ActiveCell.Offset(1, 0).Activate Loop Range("B2:B20").Select 'Here, I do not want to copy all in col B Selection.Font.ColorIndex = 9 Selection.Copy 'Paste results ActiveSheet.Paste Range("H2:H20").Select 'Here, I do not want to paste all in col H ActiveSheet.Paste Selection.Font.ColorIndex = 9 I am using range to copy and paste, but that not what I want, I just want to copy only if col E = 'a' and F = 'b' on all the row relate to this. Please help, thanks CN "Tom Ogilvy" wrote: In H2 for example, put in a formula like =if(and(E2="a",F2="b"),A2,"") then drag fill down the column. -- regards, Tom Ogilvy "CN" wrote in message ... If I has column E = "a" & col F = "b" then copy cell in col A to col H in any row have those value. Thanks in advance, CN |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
emptying the contets of a cell base on the value of another cell | Excel Worksheet Functions | |||
Define a cell value base on the date | Excel Discussion (Misc queries) | |||
Hiding row base on cell content | Excel Discussion (Misc queries) | |||
unique values in a cell base on another cell | Excel Discussion (Misc queries) | |||
change tab color base on cell value | Excel Programming |