ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding the last cell used in a file... (https://www.excelbanter.com/excel-programming/292882-finding-last-cell-used-file.html)

Jesterhoz

Finding the last cell used in a file...
 
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

--
Message posted from http://www.ExcelForum.com


Vasant Nanavati

Finding the last cell used in a file...
 
Something like:

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

--

Vasant



"Jesterhoz " wrote in message
...
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 in
the file. I have copied the formula all the way to B65536. How do I
only copy it to the last row of the workbook?

Any help would be much appreciated.

Thanks,

Trevor


---
Message posted from http://www.ExcelForum.com/




Bob Phillips[_6_]

Finding the last cell used in a file...
 
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)

"Jesterhoz " wrote in message
...
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 in
the file. I have copied the formula all the way to B65536. How do I
only copy it to the last row of the workbook?

Any help would be much appreciated.

Thanks,

Trevor


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com