![]() |
Find end of column and paste formula in range
I am extracting data from a database into Excel. My colums are constant, but
number of rows vary. I need to copy a formula from AC2 down to the last row in that column. Thanks for the help! |
Find end of column and paste formula in range
Try this small macro:
Sub CopyFormula() Dim nLastRow As Long, destynation As String Set r = ActiveSheet.UsedRange nLastRow = r.Rows.Count + r.Row - 1 destynation = "AC3:AC" & nLastRow Range("AC2").Copy Range(destynation) End Sub -- Gary''s Student - gsnu200901 "MGS" wrote: I am extracting data from a database into Excel. My colums are constant, but number of rows vary. I need to copy a formula from AC2 down to the last row in that column. Thanks for the help! |
Find end of column and paste formula in range
Will the formula already be in AC2?
Is there any adjacent column that will extend to last row? I will assume there is a formula and use column AB to determine last row. Sub Auto_Fill() Dim Lrow As Long With ActiveSheet Lrow = .Range("AB" & Rows.Count).End(xlUp).Row .Range("AC2:AC" & Lrow).FillDown End With End Sub Gord Dibben MS Excel MVP On Mon, 24 Aug 2009 16:06:02 -0700, MGS wrote: I am extracting data from a database into Excel. My colums are constant, but number of rows vary. I need to copy a formula from AC2 down to the last row in that column. Thanks for the help! |
All times are GMT +1. The time now is 11:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com