Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
mgs mgs is offline
external usenet poster
 
Posts: 2
Default 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!



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default 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!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default 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!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A macro to copy & paste many rows (a range) to the next column .. genehunter New Users to Excel 11 April 21st 09 07:36 AM
Find last column, move formulas over, copy/paste data Mike R. Excel Worksheet Functions 0 September 19th 07 06:40 AM
find and paste formula Taru Excel Worksheet Functions 2 June 16th 06 08:50 PM
Macro to find text string in a column and paste data in another nicolascap Excel Discussion (Misc queries) 8 March 14th 06 03:13 PM
I need a formula to find rows within a date range in one column? M. Penney Excel Worksheet Functions 5 May 12th 05 12:32 AM


All times are GMT +1. The time now is 04:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"