Range Syntax Using Offset

Coach3131

Board Regular
Joined
Nov 23, 2007
Messages
242
Range("ActiveCell.Offset(1, 2):ActiveCell.Offset(5, 2)").AutoFill Destination:=Range("ActiveCell.Offset(1, 2):ActiveCell.Offset(5, x)"), Type:=xlFillDefault

I am getting this error:
Method 'Range' of object'_Global failed

What is the proper syntax for this?

Thanks in advance!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
without seeing the remainder of the code can't be 100% certain but range in VBA works differently in this context

try

Range(ActiveCell.Offset(1, 2),ActiveCell.Offset(5, 2)).AutoFill Destination:=Range(ActiveCell.Offset(1, 2),ActiveCell.Offset(5, x)), Type:=xlFillDefault

when using ranges on a non R1C1 basis you would encapsulate via quotation marks with colon

Range("A1:B1")

when using R1C1 (as per your code) you use

Range(Cells(row,col),Cells(row,col))
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,309
Members
448,564
Latest member
ED38

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