MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Strings and pictures queries

  Asked By: Binge    Date: Aug 30    Category: MS Office    Views: 1371

1. I am comparing 2 strings, that contain mixed case, spaces and
apostrophes. My code isn't recognising that the strings are the same
solely because of the apostrophe's, I am guessing the data has come
from 2 different systems and the apostrophe's are different
characters. I was putting the 2 strings into string variables to see
if they matched. SHould I be using InStr and/or should I strip the
apostrophes (and spaces for consistency) before comparing? How do I
ststrip them?

2. I have a column that contains pictures, I need to refer to the
pictures in my loops to analyse the rest of the row they are in and
report on it. I can't figure out how to tell VBA how to see the
picture and ascertain whether its a certain picture. Can you help?



4 Answers Found

Answer #1    Answered By: Hiroshi Yoshida     Answered On: Aug 30

I’ll say something about #1, but don’t have something to say about #2 right

To strip apostrophes (or any character, you could use:

s = Replace(s, “’”, “”)

That’s taking a string  s, and replacing all apostrophes with nothing (a
zero-length string).

I suppose stripping out the apostrophes
is one way to go. If someone out there is a language expert, perhaps there’s
a more standard way of doing it, but it seems reasonable to me.

Also if you wanted to compare De Angelis and DeAngelis, you’d want to strip
out spaces, like:

s = Replace(s, “ “, “”)

Answer #2    Answered By: Eustatius Bakker     Answered On: Aug 30

Pictures in Excel VBA are in the Shapes collection. It's possible to loop
through each of the pictures  at a time selecting it but I'm not sure how to
return a range or row  to which they are anchored though.

Answer #3    Answered By: Ismet Yilmaz     Answered On: Aug 30

The following line will return the Row of the top left cell for shape 1.

MsgBox ActiveSheet.Shapes(1).TopLeftCell.Row

Answer #4    Answered By: Malcolm Carter     Answered On: Aug 30

, I'll be utilising both of your
pieces of advice. I look forward to interacting more and increasing
my skills.

Didn't find what you were looking for? Find more on Strings and pictures queries Or get search suggestion and latest updates.