Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a range of data (ex: A1:F20) and in the column (g) next to the
data i have a formula that adds certain fields. I am constantly adding rows of data, so what I want is a macro that will find the last row of data in column F, then paste the formula from the last row of column G down to that row. Any help is appreciated. Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way...
Sub CopyFormula() Dim rngToCopy As Range Dim rngLast As Range Set rngToCopy = Cells(Rows.Count, "G").End(xlUp) Set rngLast = Cells(Rows.Count, "F").End(xlUp) If rngToCopy.Row < rngLast.Row Then _ rngToCopy.Copy Range(rngToCopy.Offset(1, 0), rngLast.Offset(0, 1)) End Sub -- HTH... Jim Thomlinson " wrote: I have a range of data (ex: A1:F20) and in the column (g) next to the data i have a formula that adds certain fields. I am constantly adding rows of data, so what I want is a macro that will find the last row of data in column F, then paste the formula from the last row of column G down to that row. Any help is appreciated. Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect. Thanks!
On Aug 9, 1:18 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move- This-.com wrote: One way... Sub CopyFormula() Dim rngToCopy As Range Dim rngLast As Range Set rngToCopy = Cells(Rows.Count, "G").End(xlUp) Set rngLast = Cells(Rows.Count, "F").End(xlUp) If rngToCopy.Row < rngLast.Row Then _ rngToCopy.Copy Range(rngToCopy.Offset(1, 0), rngLast.Offset(0, 1)) End Sub -- HTH... Jim Thomlinson " wrote: I have a range of data (ex: A1:F20) and in the column (g) next to the data i have a formula that adds certain fields. I am constantly adding rows of data, so what I want is a macro that will find the last row of data in column F, then paste the formula from the last row of column G down to that row. Any help is appreciated. Thanks in advance.- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
FInd common data in one column then add number in adjacent column | Excel Worksheet Functions | |||
Macro to find end of column data | Excel Programming | |||
Macro to find text string in a column and paste data in another | Excel Discussion (Misc queries) | |||
Macro to find the first cell in a column with different data | Excel Discussion (Misc queries) | |||
Need Macro to Find Column Heading -- if none, then insert new column | Excel Programming |