ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Converting code to R1C1 format (https://www.excelbanter.com/excel-programming/295139-converting-code-r1c1-format.html)

Paul

Converting code to R1C1 format
 
Hi-

is it possible to write this line of code in R1C1 format
instead of hardcoding the range? I want to be able to use
it multiple times without updating the cell reference
every time. Thanks!

Selection.AutoFill Destination:=Range("E19:AN19"),
Type:=xlFillDefault



Dave Peterson[_3_]

Converting code to R1C1 format
 
How about:

With ActiveCell
.AutoFill Destination:=.Resize(1, 36), Type:=xlFillDefault
end with

But if you wanted to start in column E no matter where you were in that row:

With Cells(ActiveCell.Row, "E")
.AutoFill Destination:=.Resize(1, 36), Type:=xlFillDefault
End With



Paul wrote:

Hi-

is it possible to write this line of code in R1C1 format
instead of hardcoding the range? I want to be able to use
it multiple times without updating the cell reference
every time. Thanks!

Selection.AutoFill Destination:=Range("E19:AN19"),
Type:=xlFillDefault


--

Dave Peterson



All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com