Link to home
Start Free TrialLog in
Avatar of jskfan
jskfanFlag for Cyprus

asked on

VB script to search through Excel

I have an excel workbook that has 2 worksheets, WRK1 and WRK2 , on one worksheet WRK2 I have one column that has names and I would like to search those names if they Exist in WRK1 and if they are found they will be written on the WRK2 next column beside the existing name , if not found then the word "Not Found" will be written next to searched name in the next column.

This script will help me avoid using CTRL +F and search through thousands of names one at a time if they exist in both worksheets,

Thanks
Avatar of SiddharthRout
SiddharthRout
Flag of India image

jskfan, Here is a small tutorial that I wrote sometime back. This is for VBA but can be amended if you want to run it from vbscript. Vbscript and VBA Excel code are slightly different.

http://www.vbforums.com/showthread.php?p=3922547

Hope it helps.

Sid
Avatar of jskfan

ASKER

it looks good.
Could you please just paste here the script that can do the task I am looking for ?
jskfan: Could you please upload a sample of your workbooks. Maybe we might even be able to do it using Countif() or Vlookup() formulas.

Sid
Avatar of jskfan

ASKER

I have it at work..
here is the example.

I have one Workbook for instance WRKBK1 that has 2 Worksheets WRK1 and WRK2

WRK1 has a column for instance named NAME,
Name
ABCD
XYZF
TRYP
MITH
etc..

WRK2 has also a column named Name:
BCDG
FRHG
TRYP
MITH

now the script will read from  WRK2 names, since BCDG is not in WRK1 it will put in WRK2 in the column nest to the colum NAME, the word " Not Found"
Since TRYP and MITH are found in WRK1, it will write in WRK2 in the column next to the column Name, the word " Found"


ASKER CERTIFIED SOLUTION
Avatar of SiddharthRout
SiddharthRout
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>>Cell B2 of WRK2

Sorry, I mean cell B1 of Wrk2.

Sid
Avatar of jskfan

ASKER

I will try it later thanks
SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jskfan

ASKER

Excellent