Autofilling an R1C1 formula

AlexSlivi

New Member
Joined
Jun 17, 2011
Messages
19
For each policy, there is a premium and 20 percentages that are used in order to allocate the premium into certain funds. The R1C1 formula below is always referencing the first policy's premium ($D$2) when autofilled. Is there a way to make it reference D2 to correct the autofill problem or perhaps there's another solution, maybe a non R1C1 formula, if those exist?

Code:
For y = 0 To 95 Step 5
Range("Y2").Offset(0, y).Select
Selection.EntireColumn.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.FormulaR1C1 = "=RC[-3]/100*R2C4"
Range("Y2").Offset(0, y).AutoFill Destination:=Range(Range("Y2").Offset(0, y), _
Range("Y2").Offset(lastRow - 2, y)), Type:=xlFillDefault
Next y
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I simplified your formula, which is basically =$D2^2/100

Code:
Dim a As Range, c As Range, d As Long
Set a = Range("Y2:Y" & lastrow): Set c = a
For d = 5 To 95 Step 5
    Set c = Union(a.Offset(, d), c)
Next
c.Formula = "=$D2^2/100"
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

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