Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VLookup

Status
Not open for further replies.

kadara

Programmer
Mar 2, 2012
26
0
0
DE
Hi,
Is there any possibility to write a vlookup function in vbscript?
I would like to search values in excel worksheet and return a value in the same row.
 
What is "vlookup"?

If I'm properly assume what a "vlookup" is, you could open the file using an excel objects and search through it

Code:
set objExcel = CreateObject("Excel.Application")
set objWorkbook = objExcel.Workbooks.Open("c:\file.xls")

intRow = 2
intCol = 1
do until (objExcel.cells(intRow, intCol).value = "")
    if (inStr(objExcel.Cells(intRow, intCol).Value, "myValue")) then
        msgbox "MyValue found in row" & intRow & " col" & intCol
    end if
    intRow = intRow + 1
loop

objExcel.Quit

-Geates

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top