Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6 - Compare and highlight cell not the same

Posted on 2016-10-21
3
Medium Priority
?
84 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 49

Accepted Solution

by:
Martin Liss earned 2000 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 49

Expert Comment

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

927 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