I have been a long time lurker and this forum has been a huge help. However, I have now come across a problem which I can't seem to fix.
A quick explanation of my problem:
In column A I have a list of names, the length of which changes every week. In column B and C I have 2 formulae and in column D I have a formula which sits in two cells. Everytime I run my macro it deletes columns A:D and pastes in the new names into A it then fills in B1 and C1 with the formulae and drags it down until the last row of A. Simple enough. However my formula in D needs to be dragged down across 2 cells i.e. D1:D2.
My code is:
This only inserts the formula into B3:B4 and doesn't fill down to the last row in A.
I have also tried
but this just drags down the formula from D1. Is there a way to combine the two?
Grateful for any help.
A quick explanation of my problem:
In column A I have a list of names, the length of which changes every week. In column B and C I have 2 formulae and in column D I have a formula which sits in two cells. Everytime I run my macro it deletes columns A:D and pastes in the new names into A it then fills in B1 and C1 with the formulae and drags it down until the last row of A. Simple enough. However my formula in D needs to be dragged down across 2 cells i.e. D1:D2.
My code is:
Code:
Sub FillDown()'
'Copies the formulae in D1:D2 and copies it down to the last filled in row in column A.
'
Dim lastRow As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("d1:d2").Copy Range("d3:d", Cells(Rows.Count, "A").End(xlUp).Offset(0, 3))
End Sub
This only inserts the formula into B3:B4 and doesn't fill down to the last row in A.
I have also tried
Code:
Sub Drag_Formula_Error()'
'Fills in the error formula in column D to the last filled cell in A
Dim lastRow As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("D1").AutoFill Destination:=Range("D1:D" & lastRow)
End Sub
but this just drags down the formula from D1. Is there a way to combine the two?
Grateful for any help.