Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compare excel values 1

Status
Not open for further replies.

kyriakos70

Programmer
Jul 24, 2008
87
GR
Hello,
I have this vbscript:
Sub Find_Matches()
Dim CompareRange As Variant, b As Variant, a As Variant, x As Variant, y As Variant, z As Variant, CompareRange2 As Variant
Set CompareRange = Range("C1:C10")
Set CompareRange2 = Range("A1:A10")
For Each a In Selection(F16)
For Each x In Selection(E16)
For Each y In CompareRange
For Each z In CompareRange2
If x = y And a = z Then x.Offset(0, 1) = "YPARXEI" Else x.Offset(1, 2) = "den YAPARXEI"
Next z
Next y
Next a
Next x
End Sub


What I want to do is to compare the cell values of column C and A of the Same row with the values of the cells Of the selection F16 E16 and post a message when both values are equal.
The above code is not working.

Thank you
Kyriakos
 
Also found this vbscript it is closer but it is not working either.

Public Sub finddupkicate3()
Dim RowNum, RngRowStrt As Integer
RngRowStrt = 2
Do
RowNum = RngRowStrt + 1
RowNum = RowNum + 1
If RowNum > LastRow Then Exit Do
For i = RngRowStrt To RowNum - 1
If (Range("A" & i) = Range("E" & 2) And Range("C" & i) = Range("G" & 2)) Then 'Or (Range("B" & i) = Range("C" & j) And Range("C" & i) = Range("B" & j)) Then
Range("G" & 3) = "Duplicate"
Else
MsgBox "yuy"
End If
Next
If RowNum > LastRow Then Exit Do
RngRowStrt = RowNum
Loop
End Sub
 



Hi,

Why all this VBA?
[tt]
=countif(A:A,E2)
=countif(C:C,G2)
[/tt]


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi skipvought,
Are they for the same row of a and c?
No you're right, where should I put this code?

Thank you
 
Skip said, IMHO, that you don't need code at all, but simply formula in the cells.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top