LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Question about formulas and ranges.

Hello,

I have the following piece of code (taken from having recorded the
particular steps into a macro).

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 1/28/2009 by Juan S. Correa
'

'
Range("AD2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-18],REGION,2,FALSE)"
Range("AD2").Select
Selection.AutoFill Destination:=Range("AD2:AD4513")

End Sub

The code will add the VLOOKUP formula in cell AD2 of my spreadsheet and then
will copy/paste that formula down all the way down to AD4513. That would be
OK if the amount of data comming into the spreadsheet were constant, but some
it varies every month so defining the range as ("AD2:AD4513") is not
practical in my particular case.

What I'm looking for is a way for Excel to copy/paste the formula all the
way down to the last populated row regardless of how many rows of data there
are on the spreadsheet.

Thanks in advance,
Juan Correa


 
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
Named Ranges in Array Formulas jfitzpat Excel Worksheet Functions 2 May 20th 08 11:34 PM
DATE RANGES and other functions, formulas isrdebie Excel Worksheet Functions 7 August 21st 06 04:49 AM
formulas involving ranges Brenda463 Excel Worksheet Functions 2 July 21st 06 10:41 PM
protecting formulas with named ranges Robin Excel Programming 3 September 5th 05 03:47 AM
Ranges in array formulas cottage6 Excel Programming 3 July 20th 05 06:09 AM


All times are GMT +1. The time now is 01:37 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"