Solved

VB6 - Compare and highlight cell not the same

Posted on 2016-10-21
3
53 Views
Last Modified: 2016-10-21
Hi,

I need your help on a macro.

I have 2 grid and the 2 grids will always match on the number of rows, either 4 rows or 6 rows.

What i would like to do is to highlight each cells from grid 1 that would not match the second grid cells.

Compare 2 grids
How can i do that?

I'm attaching a sample of the project.

Thanks
Test1.zip
0
Comment
Question by:Wilder1626
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 41854650
Private Sub Command1_Click()
Dim lngCol As Long
Dim lngRow As Long

For lngRow = 1 To MSHFlexGrid1.Rows - 1
    For lngCol = 0 To MSHFlexGrid1.Cols - 1
        If MSHFlexGrid1.TextMatrix(lngRow, lngCol) <> MSHFlexGrid2.TextMatrix(lngRow, lngCol) Then
            MSHFlexGrid1.Row = lngRow
            MSHFlexGrid1.Col = lngCol
            MSHFlexGrid1.CellBackColor = vbYellow
        End If
    Next
Next
End Sub

Open in new window

0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 41854654
Thanks for your help. really appreciate.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41854655
You're welcome.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

828 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