How to add OnError vba on my current subroutine?

eshnider21

New Member
Joined
Jul 31, 2021
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
I tried adding OnError on my current sub. I success adding it but it always shows the Error message even there is no error. How to add the OnError correctly?


Public Sub Searcher()
Dim wss As Integer
wss = Application.InputBox("Please enter Sheet Number", "Sheet Select", Type:=1)
With ThisWorkbook.Worksheets(wss)
.Select
.Activate
End With
End Sub
 
Post #2 has the solution to this question. Therefore, I switched the solution post accordingly.

@eshnider21 - In your future questions. please mark the post as the solution that answered the question as it will help future readers. No further action is required for this thread.
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Post #2 has the solution to this question. Therefore, I switched the solution post accordingly.

@eshnider21 - In your future questions. please mark the post as the solution that answered the question as it will help future readers. No further action is required for this thread.
Okay. Thank you smozgur. Sorry I was looking for the edit post last time to mark it as "Solved" but this forum is different. Thank you for informing me how to close threads here.
 
Upvote 0
Okay. Thank you smozgur. Sorry I was looking for the edit post last time to mark it as "Solved" but this forum is different. Thank you for informing me how to close threads here.
No problem at all. In the MrExcel Message Board, we mark the solution posts instead of closing the threads. This way, it is easier to jump to the solution that solved the problem for future readers.

Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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