Solved

VB6 - Compare and highlight cell not the same

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

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
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
Comment Utility
Thanks for your help. really appreciate.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
You're welcome.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now