AutoFill using Cells or R1C1 in a formula

288enzo

Well-known Member
Joined
Feb 8, 2009
Messages
727
Office Version
  1. 2016
Platform
  1. Windows
I'm trying to use Cells more these days over Range, and have dipped my toes into R1C1.

I'm using AutoFill, and what I have encountered is when using R1C1 the referenced cell is locked, similar to using anchors.
When I tried Cells in the formula I receive "#NAME?".

I'm trying to learn other options other than Cells(5, 10).Formula = "=Y5", maybe that's the best solution?

VBA Code:
LR = Cells(Rows.Count, 1).End(xlUp).Row
Cells(5, 10).Formula = "=" & Cells(5, 25) or Cells(5, 10).FormulaR1C1 = "=R5C25"
Cells(5, 10).AutoFill Destination:=Range(Cells(5, 10), Cells(LR, 10)), Type:=xlFillDefault

Thank you
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
What exactly are you trying to do?
 
Upvote 0
What exactly are you trying to do?
VBA Code:
LR = Cells(Rows.Count, 1).End(xlUp).Row
Cells(5, 10).Formula = "=Y5"
Cells(5, 10).AutoFill Destination:=Range(Cells(5, 10), Cells(LR, 10)), Type:=xlFillDefault

Copy the values in column Y and paste them into column J, starting at row 5 and ending at the Last Row.

I know how, I was curious about alternatives using Cells or R1C1 in the formula.

Thanks
 
Upvote 0
Ok, how about
VBA Code:
Range(Cells(5, 10), Cells(LR, 10)).FormulaR1C1="=RC25"
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,814
Members
452,945
Latest member
Bib195

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