Copy addresses in multiple places provided

sofas

Well-known Member
Joined
Sep 11, 2022
Messages
559
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Hello, I found this code here. It was posted by someone
@DanteAmor works fine for me, but it requires some modifications to match the original file.
I am copying data from Sheet 1 to Sheet 2 with a certain number of rows, which is 10, leaving 4 rows empty. What I want to do now is copy the titles for every 10 rows copied. Indeed, is there a way that I can use it without writing the names of the paste cell, because it is actually fixed and does not change. The first cell is A1. Every 14 rows, the titles are copied. But when I make sure the cell in the 15th row has a value. A column
With the word TOTAL inserted under every 10 rows, i.e. row 11 of each column range ( j )If it is possible thank you
VBA Code:
Sub Copy_Values()
  Dim i As Long
  Dim sh As Worksheet
  Set sh = Sheet1
 
  Dim dest As Worksheet
  Set dest = Sheet2
 
  Application.ScreenUpdating = False

 Dim ary As Variant
  ary = Array("A1", "a15", "a29", "a43", "a57", "a71") '...............................................unknown  ***Always + 14 Rows******
              
  For i = 0 To UBound(ary)
   sh.Range("A1:P3").Copy
    dest.Range(ary(i)).PasteSpecial xlPasteValues
     dest.Range(ary(i)).PasteSpecial Paste:=xlPasteFormats

    
  
  Next
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hello. Is there any idea that enables me to copy the data every 10 separate rows?
Hello, I found this code here. It was posted by someone
@DanteAmor works fine for me, but it requires some modifications to match the original file.
I am copying data from Sheet 1 to Sheet 2 with a certain number of rows, which is 10, leaving 4 rows empty. What I want to do now is copy the titles for every 10 rows copied. Indeed, is there a way that I can use it without writing the names of the paste cell, because it is actually fixed and does not change. The first cell is A1. Every 14 rows, the titles are copied. But when I make sure the cell in the 15th row has a value. A column
With the word TOTAL inserted under every 10 rows, i.e. row 11 of each column range ( j )If it is possible thank you
VBA Code:
Sub Copy_Values()
  Dim i As Long
  Dim sh As Worksheet
  Set sh = Sheet1
 
  Dim dest As Worksheet
  Set dest = Sheet2
 
  Application.ScreenUpdating = False

 Dim ary As Variant
  ary = Array("A1", "a15", "a29", "a43", "a57", "a71") '...............................................unknown  ***Always + 14 Rows******
             
  For i = 0 To UBound(ary)
   sh.Range("A1:P3").Copy
    dest.Range(ary(i)).PasteSpecial xlPasteValues
     dest.Range(ary(i)).PasteSpecial Paste:=xlPasteFormats

   
 
  Next
End Sub
Hi.Is there any suggestion that can do this?
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,177
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

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.
Go back
Back
Top