Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBScript: If value found in column A, show value in B

$
0
0

Hi,

I have tried for quite some time to make a vbscript which will allow me to search a excel sheet within a spesific column (A) for a spesific keyword. If there is a match in column A for the keyword, I want to be given the value belonging next to it (B). Like a VLOOKUP in Excel.

I have found out how to search for a given value in A, but it won't give me the value from B.

A snippet of my code is as following:

WHAT_TO_FIND = "something" 
File_Path = "C:\test\users.xls"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oExcel = CreateObject("Excel.Application")
Set oData = oExcel.Workbooks.Open(File_Path)
Set FoundCell = oData.Worksheets("Ark1").Range("A2:B500").Find(WHAT_TO_FIND)


Should anyone feel the urge to give me some assistance, I would be grateful.



Viewing all articles
Browse latest Browse all 15028

Trending Articles