![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 14
|
How could you copy three cells in the same row to a different sheet?
Ex.. I is the row count, and I want to copy the cell (I,”B) and Cell (I,”C”) And Cell (I,”M”) For i = Cells (Rows. Count, "M"). End (xlUp). Row To 1 Step –1 I did that but it did not work??!! Cells(i,"B"),Cells(i,"C"),Cells(i,"M").copy Please help |
|
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
Sub Copytest()
Dim i As Double For i = Cells(Rows.Count, "M").End(xlUp).Row To 1 Step -1 Application.Union(Cells(i, "B"), Cells(i, "C"), Cells(i, "M")).Copy Cells(i, "N") Next End Sub HTH Ivan |
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Forgot to mention that I assumed you were
to paste to Column N ?? Change as required Ivan |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
That should be.......
Sub Copytest() Dim i As Double For i = Cells(Rows.Count, "M").End(xlUp).Row To 1 Step -1 Application.Union(Cells(i, "B"), Cells(i, "C"), Cells(i, "M")).Copy Sheets("Sheet2").Cells(i, "A") Next End Sub Ivan |
|
|
|
|
|
#5 |
|
New Member
Join Date: Feb 2002
Posts: 14
|
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Just to make sure we're on the same track, Ivan's code pastes the code to Sheet2!A:C, not Sheet2!B, C and M.
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Feb 2002
Posts: 14
|
Thank you
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|