?
Solved

VB6 - Value like between 2 cells in MSHFlexgrid

Posted on 2014-04-19
3
Medium Priority
?
344 Views
Last Modified: 2014-04-19
Hi,

I have the below code that search a value from a specific column and row into another column and row in the same MSHFlexgrid:

    Dim C As Long
    Dim R As Long

    For C = 1 To MSHFlexGrid_rates.Cols - 1
        If MSHFlexGrid_rates.TextMatrix(0, C) = MSHFlexGrid_rates.TextMatrix(1, 4) Then
            For R = 1 To MSHFlexGrid_rates.Rows - 1
                If Left(MSHFlexGrid_rates.TextMatrix(R, C), 2) = Left(MSHFlexGrid_rates.TextMatrix(1, 6), 2) Then
                    MSHFlexGrid_rates.Row = R
                    MSHFlexGrid_rates.Col = C
                    MSHFlexGrid_rates.CellBackColor = &H80FF&
                End If
            Next R
        End If
    Next C

Open in new window


What i'm trying to do if to update this part:
If Left(MSHFlexGrid_rates.TextMatrix(R, C), 2) = Left(MSHFlexGrid_rates.TextMatrix(1, 6), 2) Then

Open in new window


I want to say:
If MSHFlexGrid_rates.TextMatrix(R, C) contains MSHFlexGrid_rates.TextMatrix(1, 6) then

Ex:
If in MSHFlexGrid_rates.TextMatrix(1, 6) i have the value: 1559 and in MSHFlexGrid_rates.TextMatrix(R, C) i have a value: 1559.00 or 1559675, it would then put the cells in orange.

It is important to tell that the number of characters may vary in MSHFlexGrid_rates.TextMatrix(1, 6).

How can i do that?

Thanks
0
Comment
Question by:Wilder1626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 40010483
If InStr(1, MSHFlexGrid_rates.TextMatrix(R, C), MSHFlexGrid_rates.TextMatrix(1, 6)) Then...
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 40010497
Thanks for your help. it works
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40010503
As always, you're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question