Finding the last cell used in a file...

J

Jesterhoz

Hello all,

I need to copy a formula in B2 to all cells below it in column B.
However, thus far, I haven't been able to locate the last used row i
the file. I have copied the formula all the way to B65536. How do
only copy it to the last row of the workbook?

Any help would be much appreciated.

Thanks,

Trevo
 
V

Vasant Nanavati

Something like:

With ActiveSheet
.Range("B2").Copy .Range(.Range("B3"), .Range("B" & _
.UsedRange.Row + .UsedRange.Rows.Count - 1))
End With
 
B

Bob Phillips

Trevor,

Here is an example

Range("B2").AutoFill Destination:=Range("B2").Resize(Cells(Rows.Count,
"B").End(xlUp).Row, 1)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top