Macro to Copy and Paste
Solved/Closed
sholly64
Posts
4
Registration date
Tuesday August 16, 2011
Status
Member
Last seen
August 16, 2011
-
Aug 16, 2011 at 08:27 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 16, 2011 at 12:39 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 16, 2011 at 12:39 PM
Related:
- Macro to Copy and Paste
- Spell number in excel without macro - Guide
- Copy and paste fonts - Guide
- How to paste photo in resume - Guide
- Excel macro to create new sheet based on value in cells - Guide
- Macro excel download - Download - Spreadsheets
3 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Aug 16, 2011 at 10:35 AM
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
Posts
4
Registration date
Tuesday August 16, 2011
Status
Member
Last seen
August 16, 2011
Aug 16, 2011 at 10:50 AM
Aug 16, 2011 at 10:50 AM
Thank you for the reply. Yes, that is what I would like to do.
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Aug 16, 2011 at 11:05 AM
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
Posts
4
Registration date
Tuesday August 16, 2011
Status
Member
Last seen
August 16, 2011
Aug 16, 2011 at 11:54 AM
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
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Aug 16, 2011 at 12:39 PM
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