Dynamic AutoFill Destination

ilcaa

Well-known Member
Joined
May 25, 2005
Messages
751
Office Version
  1. 365
Platform
  1. Windows
Currently running a macro with an autofill destination.. Problem is that starting tommorrow the range of the fill will be completely different and each day download will be different from the next... How can I chnage the macro to autofill based on the current range no matter it length?

thanks..

ActiveCell.FormulaR1C1 = "=rankings "
Selection.AutoFill Destination:=Range("J2:J17")
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try this one.

ActiveCell.FormulaR1C1 = "=rankings "
Selection.AutoFill Destination:=Range("J2:J" & range("A65536").end(xlup).row)

Assuming the last row in Column A is equal to the last row of the file. So you can chage it as needed. (ie B65536, C65536, etc.)
 
Upvote 0
Do you actually need to use autofill?

Dim End_Row As Long
End_Row = Range("J" & Rows.Count).End(xlUp).Row
Range(J2:J" & End_Row).Formula = "=rankings "

By the way, is 'rankings' a defined name containing a formula, or simply a text string. If it's just text, you could simplify this to:
Range(J2:J" & End_Row) = "rankings"
 
Upvote 0

Forum statistics

Threads
1,211,457
Messages
6,101,964
Members
447,766
Latest member
cool_aikon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top