PDA

View Full Version : Solved: Checklist compare



lienlee
06-30-2011, 08:08 AM
Morning Everyone :hi:

I require some assistance with comparing columns and creating a checklist to confirm.

I want to have Column A as a check list to mark off all the compared columns to confirm it's good, so X for compare is correct.

For clarification i want compare column B and C, D and E, F and G, and so on. I may need more columns to compare also, but i can reuse the prior the code above

But when they do the compare for each two comparison, B and C vs D and E - if both are correct i need column A to have an X to show all the compares are matching. I've attached an excel document of the desired output.

If possible I need a macro to do this.

Your help is really appricated and thank you for your assistance on this matter. Vbaexpress forum is probably the best place to learn new stuff.

lienlee
06-30-2011, 11:44 AM
I have the following code here that works for one cell, but not so sure how to do for a range of cells..:S..it's a start?


Sub Test()
wsName = "Sheet1"
Worksheets("Sheet1").Activate
Dim FirstMatch As Boolean
Dim SecondMatch As Boolean
intColNum = 1

'For intRowCount = 1 To Sheets(wsName).Range("E").CurrentRegion.Rows.Count
If Range("B2").Value = Range("C2").Value Then
FirstMatch = True
Else
FirstMatch = False
End If
If Range("D2").Value = Range("E2").Value Then
SecondMatch = True
Else
SecondMatch = False
End If

If FirstMatch = True And SecondMatch = True Then
Range("A2").Value = "x"
ElseIf FirstMatch = False And SecondMatch = True Then
Range("A2").Value = "False"
ElseIf FirstMatch = False And SecondMatch = False Then
Range("A2").Value = "False"
ElseIf FirstMatch = True And SecondMatch = False Then
Range("A2").Value = "False"

End If
'Next intRowCount
End Sub

mikerickson
07-01-2011, 07:10 AM
I was going to suggest a formula like
=IF(AND(B1=C1,D1=E1,F1=G1),"x","")

But then I noticed that the file considers "String 2" and "String2" as the same. (Cells D2 and E2)
Is that correct or an error in the example?

lienlee
07-01-2011, 08:04 PM
it is error. my apologies.