Dear All,
In the below code "On Error Resume Next" is not working. My first value is BDP if am not able to find that next value is SECURE, it should go to next. but is not happeeing. Please help
Sub FindLob()
Dim cl As Range
Dim ws As Worksheet
Dim SearchString As String
Dim search(1 To 5) As String
' Workbooks("cosmos access thru vba.xlsm").Sheets(5).Activate
'Sheets("calcSheet").Activate
Set ws = Worksheets("Cal")
ActiveSheet.Range("A1").Select
Application.FindFormat.Clear
' Find first instance on sheet
On Error GoTo Process:
Set cl = ws.Cells.Find(What:=".com", After:=ws.Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
cl.Activate
'FindText (".com")
ActiveCell.Offset(0, 1).Select
Selection.FormulaR1C1 = "=TRIM(RC[-1])"
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.FormulaR1C1 = "=MID(RC[-1],FIND("" "",RC[-1],1)+1,40)"
GpsData(6) = ActiveCell.Value 'Assign HICN to variable
'Selection.ClearContents
If GpsData(6) = "" Then
Process:
On Error GoTo 0
search(1) = "BDP"
search(2) = "SECURE"
Range("B1").Activate
ActiveCell.FormulaR1C1 = "=TRIM(RC[-1])"
Range("B1").Select
Selection.Copy
Range("B1:B300").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
For i = 1 To 5
'MsgBox ActiveCell.Rows.Address
On Error Resume Next
Selection.Find(What:=search(1), After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
If ActiveCell.Rows.Address <> "$B$1" Then
Location = ActiveCell.Rows.Address
GpsData(6) = ActiveCell.Value
Exit For
End If
Next
End If
End Sub