Copying a range with a twist

Mel Smith

Well-known Member
Joined
Dec 13, 2005
Messages
1,023
Office Version
  1. 365
Platform
  1. Windows
Hello folks,

I want to copy a range of cells (A1:AP165) 59 times. If that was all I wanted, then no problem. The issue I have is that cell A2 refers as follows: =Feeder!$A$2. When the range is copied for the first time, the reference needs to change to $A$3 and then $A$4 and so on.

I could change cell A2 to be =Feeder!A2 but how can I get the reference to increase by 1 on each copying of the range.

Many thanks for your help.

Mel
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Where do you want to copy it to?
 
Upvote 0
The next range will start at A166 and so on.

Mel
 
Upvote 0
Ok, how about
VBA Code:
Sub MelSmith()
   Dim i As Long
   Range("A1:AP165").Copy Range("A166").Resize(165 * 9, 42)
   With Range("A:A").SpecialCells(xlFormulas).Areas
      For i = 2 To .Count
         .Item(i).Formula = "=Feeder!$A$" & i + 1
      Next i
   End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,805
Members
449,127
Latest member
Cyko

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