|
Subject:
|
VLookup with Strings Problem
|
|
Posted By:
|
dem1an
|
Post Date:
|
6/3/2008 8:01:48 AM
|
How do you use a string in arg1 of vlookup?
I'm getting "Unable to get the VLookup property of the WorksheetFunction class" when using a string search.
Dim HRCList As Range Set HRCList = Worksheets("New HRC List").Range("B9:L98") Dim PortsList As Range [ t]Set PortsList = Worksheets("Remote Apps").Range("B9:I98") Dim GetApp As String Dim GetPort As String Dim TotalApps As Integer Dim TotalPorts As Integer
This one works because I didn't define a string search. Before I got this to work, I was using a string in arg1. This string was equal to the argument in the formulat now and it didn't work. Obviously there is a catch I'm not getting.
TotalApps = Application.WorksheetFunction.VLookup(Worksheets("Customer Data").Cells(Counter + 2, 18), HRCList, 3, False)
This one does not, because of the string. GetPort = Application.WorksheetFunction.VLookup(GetApp, PortsList, TotalPorts + 2, False)
Thanks for any help you can provide.
dem
|
|
Reply By:
|
dem1an
|
Reply Date:
|
6/3/2008 10:46:38 AM
|
I hope someone can help me. I'm having trouble with my VB Vlookups with a string as the search arg1.
The following doesn't work because SystemCode is a String:
ProductName = Application.WorksheetFunction.VLookup(SystemCode, Worksheets("New HRC List").Range("B9:C98"), 2, False)
This works because the SystemCode is defined:
ProductName = Application.WorksheetFunction.VLookup(Worksheets("Customer Data").Cells(Counter + 2, 18), Worksheets("New HRC List").Range("B9:C98"), 2, False)
What syntax will work with a string?
|
|