Repeating a chunk of code across a range

BenjaminDubai

New Member
Joined
May 7, 2007
Messages
42
What I would like to do is repeat the below formula changing 2 things 50 times.

What I want to change is highlighted.

'Add formaula to cell

Sheets("Resources").Select
Range("A3").Select
ActiveCell.FormulaR1C1 = _
"=AND('Resource%PerWeek'!RC2=Resources!R1C,Dates!RC1=TRUE)"

'Autofill the page
Application.Run "'Resource%Calculator.xls'!AutofillArea"

'Select the range that is now correct, copy and paste values

Sheets("Resource%PerWeek").Select
Range("C3:C1119").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False


I would like the column to move from 1 to 2, to 3, etc... until 50.

I would like the range to move from C3:C1119 to D3:D1119 to E3:E1119 etc until it hits AZ3:AZ1119
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,221,218
Messages
6,158,595
Members
451,501
Latest member
andysacko

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