ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable Autofill Range (https://www.excelbanter.com/excel-programming/292314-variable-autofill-range.html)

kate

Variable Autofill Range
 
Hi,
I'm creating a macro that autofills down formulas from the
top row. The problem is that the list changes from day to
day, and I can't have it pre-filled to a set number
because it affects the pivot table I'm doing.

Is there a code for setting up the macro so that it fills
to the end of whatever list there is?
Ex:

1 2 3 formu1 formu2
2 3 4
3 4 5
4 5 6
5 6 7
6 7 8
7 8 9
8 9 0

The macro needs to copy the formula down to the end of
however many rows are on the list. The macro could run on
a list of 400 rows, or it could run off a list of 375
rows, etc.

Any ideas???
-Kate

Tom Ogilvy

Variable Autofill Range
 
J.E. McGimpsey suggested this to the first posting of your question:

One way:


Range("D1:E1").AutoFill _
Destination:=Range("D1:E" & _
Range("A" & Rows.Count).End(xlUp).Row), _
Type:=xlFillDefault

--
Regards,
Tom Ogilvy

"Kate" wrote in message
...
Hi,
I'm creating a macro that autofills down formulas from the
top row. The problem is that the list changes from day to
day, and I can't have it pre-filled to a set number
because it affects the pivot table I'm doing.

Is there a code for setting up the macro so that it fills
to the end of whatever list there is?
Ex:

1 2 3 formu1 formu2
2 3 4
3 4 5
4 5 6
5 6 7
6 7 8
7 8 9
8 9 0

The macro needs to copy the formula down to the end of
however many rows are on the list. The macro could run on
a list of 400 rows, or it could run off a list of 375
rows, etc.

Any ideas???
-Kate





All times are GMT +1. The time now is 12:12 AM.

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