Solved

VB6 - Compare and highlight cell not the same

Posted on 2016-10-21
3
51 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

803 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