I think your instr are wrong
try:
Main Topics
Browse All TopicsHi, I have a macro that goes down through a column in a document and if a cell has the word "check" in it, it'll check the row of that cell and check it out. How I want to "check" it is to see if one of the cells in the row has certain text like "drive," "street," "avenue," etc (this is an address correction program), and if it's adjacent cell has "dr" or "st" or "ave" etc.
The code I currently have gives me a "mismatch" error, and I'm somewhat of a novice in visual basic so I don't understand what's wrong. Whenever I see that one row of cells has "street" in a cell and in the next one is a "st" then I want to change the active cell from "check" to "exact match."
On a similar note, is there anyway to ignore punctuation in a cell when scanning the cells for discrepancies? Any help is appreciated, thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ok...I see...you will have to include to your code a subfunction that eliminates all the punctuation marks and compares the strings without that...something like this:
(1) you will need to set the current value of the cell to a string variable
ie. mycell1 = ActiveCell.Offset(0, -15).Value
(2) eliminate any punctuation marks from this string (mycell1) using a subfunction like below (use a subfunction because you are going to call it in a number of occasions)
ie. mycell1 = removepuncmarks(mycell1)
(3) compare in the instr mycell1 instead of the value
That should do your trick! Hope you have everything in order now...its my advice to ignore SPACES too, they tend to create different strings without any meaning of difference (1 space or 2). However you can do that with TRIM in Excel to avoid deleting the spaces between the address and the DR or AVE part of your addresses.
Business Accounts
Answer for Membership
by: dandrakaPosted on 2009-09-16 at 08:29:20ID: 25346687
Could you attach a small portion of the file 3-4 rows with sample data? to be able to test this?