Am getting run time error on green marked line. Anyone please help to resolve this error.
Code:
Sheets("Sheet2").Select
Columns("A:A").Select
lr = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
Set r3Search = Sheets("Sheet2").Range("A1:A" & lr)
Set r3Search2 = Sheets("Sheet2").Range("A1:A" & lr)
Set r3Find = r3Search.Find("<epcrealmsforroaminglist>")
If r3Find Is Nothing Then
End If
On Error GoTo Handler2
s3FirstAddress = r3Find.Address -------> [COLOR=#6600cc]Getting run time error.[/COLOR]
Set r3Find2 = r3Search.Find(What:="</epcrealmsforroaminglist>", After:=r3Find)
If r3Find2 Is Nothing Then
Exit Sub
ElseIf r3Find2.Row < r3Find.Row Then
Exit Sub
End If
s3FirstAddress2 = r3Find2.Address
Sheets("Sheet2").Range(r3Find.Offset(1), r3Find2.Offset(-1)).Copy Sheets("work").Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
Handler2:
Do
Set r3Find = r3Search.Find(What:="<epcrealmsforroaminglist>", After:=r3Find)
If r3Find.Address = s3FirstAddress Then Exit Do
Set r3Find2 = r3Search.Find(What:="</epcrealmsforroaminglist>", After:=r3Find)
If r3Find2.Address = s3FirstAddress2 Then Exit Do
Sheets("Sheet2").Range(r3Find.Offset(1), r3Find2.Offset(-1)).Copy Sheets("work").Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
Loop
Last edited by a moderator: