How to use multiple time Errhandler

Ahmed786

New Member
Joined
Jun 2, 2022
Messages
26
Office Version
  1. 2016
Platform
  1. Windows
Dear all i want to use err handler multiple time kindly help me in this regard
Sub HOME1()


Sheets("vida data after macros").Select
With Worksheets("vida data after macros").Cells
On Error GoTo errHandler
Set cl = .Find("rania", After:=.Range("A2"), LookIn:=xlValues)
If Not cl Is Nothing Then
cl.Select
End If
End With
ActiveCell.Offset(1, -5).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Dr. Abdulla Ismaeel").Select
ActiveSheet.Range("A9").Select
ActiveSheet.Paste
errHandler: Sheets("vida data after macros").Select

With Worksheets("vida data after macros").Cells'UP TO HERE CODE IS WORKING FINE UNABLE TO USE ERRHANDLER SECOND TIME
On Error GoTo errHandler2:
Set cl = .Find("tania", After:=.Range("A2"), LookIn:=xlValues)
If Not cl Is Nothing Then
cl.Select
End If
End With
ActiveCell.Offset(1, -5).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Dr. Abdulla Ismaeel").Select
ActiveSheet.Range("A9").Select
ActiveSheet.Paste
errHandler2: Sheets("Dr name").Select
I GOT RUN TIME ERROR 1004

End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I cannot reproduce your error. Exactly what line causes the runtime error 1004? What error do you anticipate occurring in the code that you want to handle with On Error?
 
Upvote 0
Actually I want to know how to use errhandler multiple times
If u look at my code I first said if not find word rania then errhandler will take me to sheet vida
Which is working but when I m using again errhandler it giving me error
I set cl Tania if not find Tania in excel sheet then err handler take me to dr name sheet
Thanks again
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,172
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top