Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Vlookup Macro to return Values only

Hello
Thank you, the first option (to add the line of code) worked perfectly.
I then tried the second option as you say would be the better option,
but unfortunately it returns a Compile/Syntax error on the 3rd line.

If you could get the code to work, that would be great, (if it is the better
way to do it), but your first option is working, so thanks once again.

Cheers
Ian


"MSP77079 " wrote in message ...
Two options.

One option is to leave the macro pretty much as is. After you stuff
the formula in the cell, add this line of code:

Range("C" & Target.Row).Value = Range("C" & Target.Row).Value

that will replace the formula with the result.


A better option is to replace the line that reads
With Range("C" & Target.Row)
Formula = "=IF($A" & Target.Row & "="""","""",VLOOKUP($A" & _
Target.Row & "," & "PARTNUMBERS!$A$2:$B$1000,2,FALSE))"

with this:
myResult = application.WorksheetFunction.VLookup($A" & _
Target.Row & "," & "PARTNUMBERS!$A$2:$B$1000,2,FALSE)
Range("C" & Target.Row) = myResult


---
Message posted from http://www.ExcelForum.com/



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
Vlookup-Doesn't return values under 1 Carolina Excel Worksheet Functions 2 March 16th 10 03:24 PM
Vlookup-Doesn't return values under 1 Carolina Excel Worksheet Functions 1 March 16th 10 01:59 PM
VLOOKUP and Return Last 2 Values Nick Excel Worksheet Functions 5 July 10th 09 06:34 PM
How can I use the vlookup function to return a sum of the values? Chaandni Excel Discussion (Misc queries) 4 November 7th 05 03:05 PM
VBA Syntax for VLOOKUP to return array of return values Alan Beban[_3_] Excel Programming 7 August 5th 03 11:41 AM


All times are GMT +1. The time now is 03:36 PM.

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"