i'm building a macro that should copy the value from "j1" on sheet1 to "a2" on sheet2 and "k1" on sheet1 to "b2" on sheet2 and so on. I've got some parts to work but not the loop how do i do that? help would be appreciated.
Excel Facts
What do {} around a formula in the formula bar mean?
Sub CopyRange()
Dim lColumn As Long
lColumn = Sheets("Sheet1").Cells(1, Columns.Count).End(xlToLeft).Column
Sheets("Sheet1").Range(Cells(1, 10), Cells(1, lColumn)).Copy Sheets("Sheet2").Range("A2")
End Sub
If all the cells are consecutive, and where you are pasting them to is also consecutive, you shouldn't have to copy each cell individually. You should be able to do the whole range at once. Using the Macro Recorder will give you the code you need for this.
If those assumptions aren't correct, you will need to explain your problem in more detail.
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.