Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Past Macro
I have a formula that looks for matching criteria (in cell I1 vs. Column A) and copies the values to the right of it and pastes them in E (starting with E1). What I need to do is the same except the last part (starting with E1). I need to copy, but a lateral move (like shown below). If the matching value is found on row 2, then copy and paste the target cells value directly over on the same row. A B C D E F G H I 9/3 ABC 9/4 9/4 DEF DEF 9/3 GHI 9/4 JKL JKL The formula that I am working with is as follows: Sub macro3() Dim ws As Worksheet Dim iA As Integer Dim iB As Integer Dim c As Range Dim rng As Range Set ws = Worksheets("Sheet1") Set rng = ws.Range("A1:A65536") For Each c In rng If c = Range("I1") Then iA = iA + 1 ws.Cells(iA, 5) = c.Offset(0, 1) End If Next c End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Past Macro
Sub macro3()
Dim c As Range Dim rng As Range Dim ws As Worksheet Set ws = Worksheets("Sheet1") Set rng = ws.Range("A1:A" & ws.Cells(ws.Rows.Count, "A").End(xlUp).Row) For Each c In rng If c.Value = Range("I1").Value Then c.Offset(0, 4).Value = c.Offset(0, 1).Value End If Next c End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "J.W. Aldridge" wrote in message ups.com... I have a formula that looks for matching criteria (in cell I1 vs. Column A) and copies the values to the right of it and pastes them in E (starting with E1). What I need to do is the same except the last part (starting with E1). I need to copy, but a lateral move (like shown below). If the matching value is found on row 2, then copy and paste the target cells value directly over on the same row. A B C D E F G H I 9/3 ABC 9/4 9/4 DEF DEF 9/3 GHI 9/4 JKL JKL The formula that I am working with is as follows: Sub macro3() Dim ws As Worksheet Dim iA As Integer Dim iB As Integer Dim c As Range Dim rng As Range Set ws = Worksheets("Sheet1") Set rng = ws.Range("A1:A65536") For Each c In rng If c = Range("I1") Then iA = iA + 1 ws.Cells(iA, 5) = c.Offset(0, 1) End If Next c End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Past Macro
When I get my first million....... I'm buying you a Krystal Burger (with Cheese!) THANX!!!!!!!!! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy and Past Macro
Big spender
-- Don Guillett Microsoft MVP Excel SalesAid Software "J.W. Aldridge" wrote in message ups.com... When I get my first million....... I'm buying you a Krystal Burger (with Cheese!) THANX!!!!!!!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to Copy/Paste Data into one wksht, skipp one row before past | Excel Discussion (Misc queries) | |||
Macro to copy and past a new row when the a row is filled in. | Excel Programming | |||
Macro: Insert, copy and past data from sheet | Excel Discussion (Misc queries) | |||
Copy Past with macro | Excel Programming | |||
Macro to copy and past selected rows only... | Excel Programming |