Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I am trying to have a MACRO automatically do a VLOOKUP and paste the results into my spreadsheet. I have input the formula manually and it works, so I know the file names and ranges are correct. Column A is the data to lookup and Column B is where I want the VLOOKUP to enter the results. My futile effort for a code is below: Worksheets("Sheet 1").Activate Set CurrentCell = Range("A2") Do While Not IsEmpty(CurrentCell) Set CurrentCell = CurrentCell.Offset(0, 1) Set NextCell = CurrentCell.Offset(1, 0) Range("B2").Select ActiveCell.FormulaR1C1 = _ "=VLOOKUP(RC[-1], '[FILE NAME.xls]Sheet1'!$A$2:$B$1147,1,FALSE)" CurrentCell.Copy Selection.PasteSpecial Paste:=x1Values Application.CutCopyMode = False Set CurrentCell = NextCell Loop Next End Sub I Get a Run-time error 1004 - Application Defined or object defined error. Does anyone have any suggestions? I know this is probably an easy fix but it is driving me crazy. Thanks ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If (Vlookup 0) working, but what if Vlookup cell does not exist | Excel Worksheet Functions | |||
VLookUp - Does the VLookUp return the exact information? | Excel Worksheet Functions | |||
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP | Excel Discussion (Misc queries) | |||
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) | New Users to Excel | |||
Vlookup info being used without vlookup table attached? | Excel Worksheet Functions |