the line:
    If FindCell(Counter) <> "D" Then

tests to see if the array element was NOT EQUAL to "D" (and "D" alone!)
what you WANT to do is test to see if the letter "D" is IN the string.

the function you're looking for is "Instr"
like:
    If (InStr(1, FindCell(Counter), "D") = 0) then
this will look for a Capital "D" anywhere in the array element.

hope this helps.

Paul




________________________________
From: Ane <anelisago...@gmail.com>
To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
Sent: Thursday, June 18, 2009 1:04:02 PM
Subject: $$Excel-Macros$$ Array + String + Compare


Hello

I have an array of String that stores information such as:

  Dim FindCell () As String

example:
FindCell = (A1, B3, C4, D5, D6, D7, D8, E9 ,...}

I want to do a check
If it finds any information in this array that starts with or contain
the letter 'D'. .. show MsgBox for example ....

this is my original code:

For Counter = LBound(FindCell) To UBound(FindCell)
            If FindCell(Counter) <> "D" Then
              ActiveSheet.Hyperlinks.Add Anchor:=Range("C" & Counter
+ 10), _
              Address:="", SubAddress:=FindSheet(Counter) & "!" &
FindCell(Counter), _
              TextToDisplay:=FindSheet(Counter) & "!" & FindCell
(Counter)

              Range("F" & Counter + 10).Value = FindText(Counter)
              Range("D" & Counter + 10).Value = FindSheet(Counter)
            End If
    Next Counter


This code is working. but do not leave out the cells with "D"...
But now I would like to refine it..

So the question is...
how Can I verify if a value into a array position contain or not the
character???
I imagine that this is a string compare... but I do not know how to do
it...

Can someone help me??

Thanks a lot,

Ane





--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to