Macro to Copy and Paste
Solved/Closed
sholly64
rizvisa1
- Posts
- 4
- Registration date
- Tuesday August 16, 2011
- Status
- Member
- Last seen
- August 16, 2011
rizvisa1
- Posts
- 4479
- Registration date
- Thursday January 28, 2010
- Status
- Contributor
- Last seen
- May 5, 2022
Related:
- Macro to Copy and Paste
- Macro to copy and paste to end of data - Guide
- Excel macro to copy and paste from one worksheet to another - Guide
- Macro to copy and paste values ✓ - Forum - Excel
- Macro help...copying and pasteing ✓ - Forum - Excel
- How To Create Macro to Search, Copy, & Paste ✓ - Forum - Excel
3 replies
rizvisa1
Aug 16, 2011 at 10:35 AM
- Posts
- 4479
- Registration date
- Thursday January 28, 2010
- Status
- Contributor
- Last seen
- May 5, 2022
Aug 16, 2011 at 10:35 AM
So why there is a jump between A1 and A13. Are you only copying every 12th row ?
sholly64
Aug 16, 2011 at 10:50 AM
- Posts
- 4
- Registration date
- Tuesday August 16, 2011
- Status
- Member
- Last seen
- August 16, 2011
Aug 16, 2011 at 10:50 AM
Thank you for the reply. Yes, that is what I would like to do.
rizvisa1
Aug 16, 2011 at 11:05 AM
- Posts
- 4479
- Registration date
- Thursday January 28, 2010
- Status
- Contributor
- Last seen
- May 5, 2022
Aug 16, 2011 at 11:05 AM
Try this
Assumption is that you want to
process rows in a chunk of 12
you want to quit if the cell in column A of the first cell of chunk (a1, a13, ...) is blank
Note:
I am not sure if this will work
Range(Cells(lRow, "K"), Cells(lRow, "N")).Paste Link:=True
If it does not, try with
Range(Cells(lRow, "K"), Cells(lRow, "M")).Paste Link:=True
If it still does not work, please upload a sample file with sample data at some file sharing site and post back the link to the file back here
Assumption is that you want to
process rows in a chunk of 12
you want to quit if the cell in column A of the first cell of chunk (a1, a13, ...) is blank
Sub doCopyRange() Dim lRow As Long lRow = 1 Do While (Cells(lRow, 1) <> vbNullString) Application.CutCopyMode = False Cells(lRow, "A").Copy Cells(lRow, "J").Paste Link:=True Application.CutCopyMode = False Range(Cells(lRow + 10, "B"), Cells(lRow, "D")).Copy Range(Cells(lRow, "K"), Cells(lRow, "N")).Paste Link:=True Application.CutCopyMode = False lRow = lRow + 12 Loop End Sub
Note:
I am not sure if this will work
Range(Cells(lRow, "K"), Cells(lRow, "N")).Paste Link:=True
If it does not, try with
Range(Cells(lRow, "K"), Cells(lRow, "M")).Paste Link:=True
If it still does not work, please upload a sample file with sample data at some file sharing site and post back the link to the file back here
sholly64
Aug 16, 2011 at 11:54 AM
- Posts
- 4
- Registration date
- Tuesday August 16, 2011
- Status
- Member
- Last seen
- August 16, 2011
Aug 16, 2011 at 11:54 AM
Just tried it and got the following error: Run-time error '438': Object doesn't support this property or method. I clicked Debugg and the following line was highlighted: Cells(1Row, "J").Paste Link:=True
rizvisa1
Aug 16, 2011 at 12:39 PM
- Posts
- 4479
- Registration date
- Thursday January 28, 2010
- Status
- Contributor
- Last seen
- May 5, 2022
Aug 16, 2011 at 12:39 PM
please upload a sample file with sample data at some file sharing site and post back the link to the file back here