ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofill Indefinite Range in VBA/Macros (https://www.excelbanter.com/excel-programming/275264-re-autofill-indefinite-range-vba-macros.html)

steve

Autofill Indefinite Range in VBA/Macros
 
Tim

Dim lrow As Long

lrow = Cells(Rows.COUNT, "A").End(xlUp).Row
''' using R1C1 notation
Range(Cells(1,1),Cells(lrow,1).Formula="=Sum(B1:F1 )"

[pick your own formula...]

--
sb
"Tim" wrote in message
...
I am trying to write a macro that involves creating a
formula in one cell and autofilling it for the rest of the
rows in the spreadsheet. Currently I have 538 lines,
however the data will continue to grow and more rows will
be added. Is there a way to record my macro so that it
will autofill to the end of the data each time rather than
stopping at the original 538th line?

The VBA line is as follows:

Selection.Autofill Destination:=ActiveCell.Range("A1:A538")

Any help would be greatly appreciated. Thank you in
advance!

Tim






All times are GMT +1. The time now is 08:11 PM.

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