×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Find in Excel

Find in Excel

Find in Excel

(OP)
I cannot fiqure Out while find fails for one particular data. The line of the code is:
Set curRange = Sheets("Appendix B").Columns("A:A").Find(sIFRAM(iIndex))

The curRange returned for one of the items (iIndex = 210)is Nothing, it works fine for other data in sIFRAM array. I copied the value of sIFRAM(iIndex) from the immediate window and put it in find dialog box in Excel. It finds the data, I checked the spelling few times, it seems OK, any idea why this might be happening?

Thanks,

RE: Find in Excel

(OP)
I found what the problem is. In Excel trailing space characters are apparanltly ignored if you search for it using the Find ... dialog box. But if you are in VBA, Find fails if you have trailing spaces in your search string and no trailing spaces in the target cell in the search range. Funny! does anybody know how to strip the spaces from string data type in VBA?

Thanks

RE: Find in Excel

Use the following function to strip both leading and trailing spaces from a string:

CODE

Trim()


Regards,
Mike

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources