View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kathy - Lovullo Kathy - Lovullo is offline
external usenet poster
 
Posts: 16
Default Using Vlookup in VBA code

I am having some problems using the VLookup command within my VBA code. I
have successfully written some code which will pull the Novell User ID and
set it to strNovellUser.

I want to now use the strNovellUser in a VLookup function to lookup some
other information I have on another sheet (Users)in the workbook. I have
verified that my Novell UserID shows up in column 1 and there is data in
column 2, but the VLookup is either not finding it or it is not being set
properly to strName.

Below is part of the code I am using. Any help would be greatly appreciated.

===============
Public Sub BasicInfo()
Dim strName As String

strName = WorksheetFunction.VLookup(strNovellUser, _
Worksheets("Users").Range("A2:E14"), 2)
MsgBox "First Name is " & strName

End Sub
===============