Hi all
I have a macro where each time I run it, my cell references will change. How can I make the autofill change with it? The code below has what I want to happen "greened" out. The first time it uses column B. That will change with subsequent runs of the macro.
I have a macro where each time I run it, my cell references will change. How can I make the autofill change with it? The code below has what I want to happen "greened" out. The first time it uses column B. That will change with subsequent runs of the macro.
Code:
MyOriginal.Select
Set MyFirstCell = MyOriginal.Offset(0, -2)
Set MySecondCell = MyOriginal.Offset(0, -1)
' Autofill
With ActiveSheet.Range(MyFirstCell, MySecondCell)
'.AutoFill Destination:=Range(MyFirstCell.Address & ":B" & myLastRow&)
.AutoFill Destination:=Range(MyFirstCell.Address & ":" & MySecondCell.Column & myLastRow&)
End With