autofill macro

G

Guest

I am trying to make a macro that will autofill a formula to the end of a
column. However, the column is different lengths in each workbook. I
autofilled to the end of the column in the first worksheet, which was 1124
cells long. Then in my next worksheet, the length was 2264 cells long, and
it only autofilled to cell 1124. Is there anyway that I could autofill to
the "end" of each column in each worksheet? Is there anyway that excel knows
when to stop? Please help!!
 
G

Gord Dibben

glee

Sub Auto_Fill()
Dim lrow As Long
With ActiveSheet
lrow = Range("C" & Rows.Count).End(xlUp).Row
Range("C1:C" & lrow).FillDown
End With
End Sub

Or perhaps.......

Sub selectrange1()
Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column).End(xlUp)).Select
Selection.FillDown
End Sub


Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top