ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy / paste formula to last row (https://www.excelbanter.com/excel-programming/318079-re-copy-paste-formula-last-row.html)

Dave D-C

copy / paste formula to last row
 
tnriverfish wrote:
My spreadsheet has separate formulas in AC1 through AN1 and I would
like to essencially drag that formulas down through the last row that
has any data in it.
The formulas would have to adjust like a regular drag down. Any help
would be appreciated.


How about:
Sub sub1()
Dim irow99&, icol99%
ActiveSheet.UsedRange ' to get the last row, column
irow99 = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Row
icol99 = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Column
ActiveSheet.Range("AC1:AN1").Copy _
ActiveSheet.Range("AC1:AN1").Resize(irow99)
End Sub



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


All times are GMT +1. The time now is 09:51 AM.

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