Hi All,
I need some help with my below code. I have master sheet in which i am perfoming an if function. But as it huge file, i tried to limit my find operation to specific range. I need to just use Col Ak and COl B for find operation. I tried to use Union function but it throws me an error at "Sheets("Master").combrange.Select" line. Below is the code. Kindly let me know what changes needs to be done.
Thnaks for your help...
[VBA]Sub thing()
Dim cell As Range, cell2 As Range
Dim lrow As Long
Dim policynumber As Range
Dim claimnumber As Range
Dim combrange As Range
Dim i, j As Integer
Sheets("Master").Range("AK2").Select
i = Cells(Rows.Count, 1).End(xlUp).Row
Set policynumber = Range("AK2:AK" & i)
Sheets("Master").Range("B2").Select
j = Cells(Rows.Count, 1).End(xlUp).Row
Set claimnumber = Range("B2:B" & j)
Set combrange = Union(Range("B2:B" & j), Range("AK2:AK" & i))
Application.ScreenUpdating = False
For Each cell In Sheets("Policy List").Range("A2:A260")
Sheets("Master").combrange.Select
With Selection
Set cell2 = .Find(cell.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not cell2 Is Nothing Then
Sheets("Wrong List").Select
lrow = Cells(Rows.Count, 1).End(xlUp).Row + 1
ActiveSheet.Cells(lrow, 1) = cell2.Offset(0, -35).Value
ActiveSheet.Cells(lrow, 2) = cell.Value
End If
End With
Next cell
End Sub[/VBA]