Code to copy formula to variable range
Hi,
Sub CopyDown()
'
Dim lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:B1").Select
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Selection.AutoFill Destination:=Range("A1:B" & lastrow),
Type:=xlFillDefault
Range("B1:B" & lastrow).Copy
Range("B1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns(1).Delete
End Sub
"Snowsride" wrote:
I have a spreadsheet that will contain entries in Column A but the number of
rows will vary. In Cell B1 I have a formula based on Cell A1 that I want to
copy down in Column B to the last row of the data in Column A. I then need
to change the formulae in Column B to values and delete Column A.
I need some code to do this.
Grateful for any help.
Thanks
|