0
votes

I want to edit the range in Autofill code below but I'm not sure how.

'find last used cell in the row to the right
Range("B59").End(xlToRight).Select

'auto fill the formula for "Total TV"
ActiveCell.AutoFill Range(ActiveCell, ActiveCell.Offset(0, 1))

At present, the code finds the last valid cell in a row, then it autofills one cell to the right.

What I want to do:

I would to find the last valid cell, then select the active cell and the cells from 3 rows below it too and then autofill one cell to the right.

In pictures it would look like this:

  1. find last valid cell in row 59:

enter image description here

  1. select active cell and cells 3 rows below:

enter image description here

  1. Autofill one cell to the right

enter image description here

1

1 Answers

1
votes

Here is one way. No need to Select

Sub x()

Dim r As RANGE

Set r = RANGE("B59").End(xlToRight)
r.Resize(4).AutoFill r.Resize(4, 2)

End Sub