Auto fill across from last cell used

Aussie Grid

New Member
Joined
Jan 14, 2010
Messages
47
I need to auto fill from the last found cell across to "IV".
I have dates in rows 1,2,3 and formulas to fill from row 6 to 10.
The last cell is unknown as data is deleted from "B" to wherever depending on the days in the month, and I then need to auto fill from the last cell across.Essentially I'm creating a continuous sheet of dates with data entered down according to the date.

Any and all help appreciated
Aussie Grid
 

drsarao

Well-known Member
Joined
Sep 9, 2009
Messages
1,112
Try this:

Sub AutoFiller()
lc = Cells(1, Columns.Count).End(xlToLeft).Column 'last non-empty column
Range(Cells(1, lc), Cells(3, lc)).AutoFill Range(Cells(1, lc), Cells(3, "IV")), xlFillDays 'rows 1-3 dates
Range(Cells(6, lc), Cells(10, lc)).AutoFill Range(Cells(6, lc), Cells(10, "IV")), xlFillSeries 'rows 6-10 formulae
End Sub
 

Aussie Grid

New Member
Joined
Jan 14, 2010
Messages
47
Thanks for the reply. I was unable to get it working as line 2 gave me an application or object fault. Anyway have decided on a work around.
Again TKU

Aussie Grid
 

drsarao

Well-known Member
Joined
Sep 9, 2009
Messages
1,112
Thanks for the reply. I was unable to get it working as line 2 gave me an application or object fault. Anyway have decided on a work around.
Again TKU

Aussie Grid
Maybe not all rows 1 to 3 are dates. Change xlFillDays in the code to xlFillSeries.

Sub AutoFiller()
lc = Cells(1, Columns.Count).End(xlToLeft).Column 'last non-empty column
Range(Cells(1, lc), Cells(3, lc)).AutoFill Range(Cells(1, lc), Cells(3, "IV")), xlFillDays 'rows 1-3 dates
Range(Cells(6, lc), Cells(10, lc)).AutoFill Range(Cells(6, lc), Cells(10, "IV")), xlFillSeries 'rows 6-10 formulae
End Sub
 

Forum statistics

Threads
1,085,058
Messages
5,381,478
Members
401,743
Latest member
james909090

Some videos you may like

This Week's Hot Topics

Top