Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autofill | Excel Worksheet Functions | |||
AutoFill | Excel Discussion (Misc queries) | |||
Autofill? | Excel Discussion (Misc queries) | |||
Autofill: Need to autofill one week block, (5) weekday only into cells. | Excel Discussion (Misc queries) | |||
Q. Autofill question: Can I autofill alpha characters like I can numbers? | Excel Programming |