We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

VB script to search through Excel

Medium Priority
383 Views
Last Modified: 2012-05-11
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
Comment
Watch Question

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

Author

Commented:
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

Author

Commented:
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"


Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
>>>Cell B2 of WRK2

Sorry, I mean cell B1 of Wrk2.

Sid

Author

Commented:
I will try it later thanks
aikimarkSocial distance; Wear a mask; Don't touch your face; Wash your hands for 20 seconds
CERTIFIED EXPERT
Top Expert 2014
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Excellent
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.