![]() |
Autofill
Hi,
I'm trying to write a VBA code that imports a dataset (for example lines of data in rows A to G), I've managed this fine. Then in the column to the left of the data (column H) writes an equation that is then filled/copied to the left of every row with data in it. Can anyone shed some light on how to identify what the last row is (I have a column that is guaranteed to hold data (A) for the whole data set) and how to copy the equation to the last row. Thanks Dave |
Autofill
To get the last cell in a worksheet use
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) Sean "Just press the off switch, and go to sleep!" *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Autofill
set rng = Range(Cells(1,"G"),Cells(rows.count,"G").End(xlup) )
rng.offset(0,1).Formula = "=sum(A1:G1)" ' and if you really need the row number lastrow = rng.rows(rng.rows.count).row msgbox "Last row is " & lastrow -- Regards, Tom Ogilvy "dht" wrote in message ... Hi, I'm trying to write a VBA code that imports a dataset (for example lines of data in rows A to G), I've managed this fine. Then in the column to the left of the data (column H) writes an equation that is then filled/copied to the left of every row with data in it. Can anyone shed some light on how to identify what the last row is (I have a column that is guaranteed to hold data (A) for the whole data set) and how to copy the equation to the last row. Thanks Dave |
Autofill
Thanks for the response.
Got it sorted now Cheers "Tom Ogilvy" wrote in message ... set rng = Range(Cells(1,"G"),Cells(rows.count,"G").End(xlup) ) rng.offset(0,1).Formula = "=sum(A1:G1)" ' and if you really need the row number lastrow = rng.rows(rng.rows.count).row msgbox "Last row is " & lastrow -- Regards, Tom Ogilvy "dht" wrote in message ... Hi, I'm trying to write a VBA code that imports a dataset (for example lines of data in rows A to G), I've managed this fine. Then in the column to the left of the data (column H) writes an equation that is then filled/copied to the left of every row with data in it. Can anyone shed some light on how to identify what the last row is (I have a column that is guaranteed to hold data (A) for the whole data set) and how to copy the equation to the last row. Thanks Dave |
All times are GMT +1. The time now is 03:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com