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: 44
Default Syntax error found in vba vlookup

Hi Sir,

Can someone help me to check if the Vlookup function below is correct or
not? the debugger always give me error. =) awaiting for your reply...my
intention is to lookup a value in a currentrow cell from another excel sheet
table array and return 1 or 2 to determine if there are more than one line
found for that particular value.(i am trying to detect duplicate values).


Sub Look_For_Part()

Dim Look_UP_Value As Variant

Workbooks.Open Filename:="G:\Asia\Product\Operations\ML-Part
Adjustments\testing1.xls"
Windows("testing1.xls").Activate


ProductGroup$ = "G:\Asia\Product\Operations\ML-Part Adjustments\testing1.xls"

Range("C2").Select
For currentRow = 2 To NumOfRows

Answer$ = Cells(currentRow, "D")

Look_UP_Value = Trim(Range("c" & currentRow)).Value 'Select One Part Number

Answer$ = "=IF(VLOOKUP(Look_Up_Value,'[" +
ProductGroup$"]SHEET1'!A1:A65536,1,FALSE),VLOOKUP(Look_Up_Value,'[" +
ProductGroup$ ]SHEET1'!C1:C15,15,FALSE),0"
Answer1$ = Trim(Answer$)

If (Count(Answer1$)) 1 Then
Cells(currentRow, "h") = "1"
Else
Cells(currentRow, "h") = "2"
End If

Next

End Sub

 
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
how to remove #n/a error in excel vlookup b/c value is not found? B. Franklin Saunders Excel Worksheet Functions 20 April 27th 23 03:44 AM
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
Vlookup Syntax Error YV New Users to Excel 9 December 23rd 04 05:28 PM
VLOOKUP Compile/Syntax Error JimFor Excel Programming 4 December 22nd 04 06:10 PM
Syntax Error in VLOOKUP Code Ken Excel Programming 3 October 20th 04 05:50 PM


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