Set Starting Point of a range using a variable? To then copy

cwilliams96

Board Regular
Joined
Jul 27, 2003
Messages
186
Hi

I have a macro that places formula in a certain cells part way down a sheet/ The row number is defined by a variable.

Here is an example of one line of code that places a formula in column C at row i (i is a count of rows from another sheet)

Range("C" & i + 10).Formula = "=IF(LEFT('B1 - Del'!G2,1)=""T"",LEFT('B1 - Del'!G2,14),LEFT('B1 - Del'!G2,16))"

Once this and other formulas are in place I then want to select that range of formulas and copy them down a set number of rows. Say for example copying the formulas in Columns C,D,E at row i, down a set number of rows

The difficulty I am having is telling excel where the cells are I want to copy by using Range

For example if row 11 had the formulas in, I could use the below. But I need the row number to be the value in the variable i

Range("C11:E11").Select

Any help would be aprpeciated

Thanks
Chris
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Heres an example:

Code:
firstrow = 11
lastrow = 11
firstcolumn = 3
lastcolumn = 5

MsgBox Range(Cells(firstrow, firstcolumn), Cells(lastrow, lastcolumn)).Address
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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