View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
anilsolipuram[_76_] anilsolipuram[_76_] is offline
external usenet poster
 
Posts: 1
Default Comparing values in 2 columns - Help needed


Backup your workbook before trying this macro

try this macro and let me know

Sub macro()
Dim r, c As Range
Dim i, k As Variant
Range("b1:b88").Select
Set r = Selection
k = 88
For i = 1 To 88
If Range("b" & i).Value < "" Then
temp = check_value(Range("b" & i).Value)

If temp = 1 Then
Range("b" & i).Select
Selection.Delete Shift:=xlUp
i = i - 1
k = k - 1
Else

End If
End If
Next

End Sub

Function check_value(val As Variant)
Range("a1").Select
Range("a1:a88").Select
On Error Resume Next
Selection.Find(What:=val, After:=ActiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
Range(ActiveCell.Address).Select
Selection.Delete Shift:=xlUp
If Err.Description < "" Then
check_value = 0
Else
check_value = 1
End If
End Function


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=380264