LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default AutoFill using a macro

Hi katamy

I assume that you need this

Note, for column "X"

Dim l_LastRow As Long

l_LastRow = Cells(Rows.Count, "X").End(xlUp).Row

Range("X2:X" & l_LastRow).FormulaR1C1 = "=VLOOKUP(RC[-1],'[Look up Vince
report.xls]Function'!C1:C2,2,FALSE)"
' but I prefer that
Range(Cells(2, "X"), Cells(l_LastRow, "X")).FormulaR1C1 =
"=VLOOKUP(RC[-1],'[Look up Vince report.xls]Function'!C1:C2,2,FALSE)"

Premek

"katamy" wrote:

Im working in Excel 2003. I have a report which runs in another program that
I save in Excel. I then create a macro to insert columns at various places
and perform a vlookup. The data varies each time the report is run. I know
there is a code that will allow me to AutoFill down to the last row of that
column, but I cant remember how to do it. Any suggestions?

Here is the code€¦

Range("X2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-1],'[Look up Vince report.xls]Function'!C1:C2,2,FALSE)"
Selection.AutoFill Destination:=Range("X2:X2649")
Range("X2:X2649").Select

Thanks in advance for your help!

 
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
Autofill Macro. Dave A Excel Programming 2 October 30th 07 03:04 AM
Autofill macro help!! [email protected][_2_] Excel Programming 1 July 18th 07 09:16 PM
Autofill Macro Lacey Excel Programming 24 March 13th 07 09:54 PM
Autofill Macro Hayabusa Excel Programming 1 November 25th 05 05:47 PM
Autofill macro Mike G Excel Discussion (Misc queries) 6 April 21st 05 01:33 AM


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