Busybeaver
New Member
- Joined
- Nov 26, 2010
- Messages
- 20
Hi,
I've read a number of posts regarding autofill for dynamic ranges but they all refer to number of rows. Is there a way to also calculate a varying number of columns please? (PS: I love this site, I almost always find the help I need by reading through the threads!)
I have a dataset that will change number of both columns and rows. Under each column header is a formula. What I am trying to do is mimic the action of highlighting existing columns and autofilling the formulae down to the last row.
Range("B2").Select
Range(Selection, Selection.End(xlToRight)).Select
' This next part doesn't work because obviously it is only looking at column M and not all highlighted columns. Can I also make the column reference dynamic?
Selection.AutoFill Destination:=Range("M2:M" & Range("A" & Rows.Count).End(xlUp).Row)
Below is a sample of the sheet. Row 2 holds the formulae.
I've read a number of posts regarding autofill for dynamic ranges but they all refer to number of rows. Is there a way to also calculate a varying number of columns please? (PS: I love this site, I almost always find the help I need by reading through the threads!)
I have a dataset that will change number of both columns and rows. Under each column header is a formula. What I am trying to do is mimic the action of highlighting existing columns and autofilling the formulae down to the last row.
Range("B2").Select
Range(Selection, Selection.End(xlToRight)).Select
' This next part doesn't work because obviously it is only looking at column M and not all highlighted columns. Can I also make the column reference dynamic?
Selection.AutoFill Destination:=Range("M2:M" & Range("A" & Rows.Count).End(xlUp).Row)
Below is a sample of the sheet. Row 2 holds the formulae.