Solved

VB6 - Compare and highlight cell not the same

Posted on 2016-10-21
3
68 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
[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 48

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 48

Expert Comment

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

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
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…

630 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