Sub Thanks(sReason As String) Dim NewLine as String NewLine=vbCrLf MsgBox("Thank you Sir" & NewLine & sReason) End Sub Call Thanks("You saved my life with that piece of code!!!")
Terrific approach, especially as it retraces the entire stack of procedure calls. I've learned so much from subscribing to your channel. Cheers, Brendan
Paul awesome content. You have given key value on VBA language. We have never come across such a useful error handling procedure. Merry X'Mas 😄😃😍 Big Thumbs up 👍👍👍
This the most useful strategy I have found on the internet. Unfortunately, it doesn't seem to work when you use it on userforms. When the error is found inside of a command button of a userform, the code stops where the err.raise line is located. That was very frustrating for me not to be able of using this powerful strategy in my code. Besides that... Thanks very much for your incredible job :)
'Just recently came across your excellent videos, so not sure if you're still reading comments. If so, I've tried a number of ways to implement your error handling code to no avail (put the ErrorHandling module into a sandbox, copied test routines from your website and ran them, but message box with error readout doesn't come up). Is there some way of determining what is missing? I'd love to replace my current, klunkier error handling with this technique. Thx!
Excellent video. The problem with throwing errors is that with a large procedural subroutine, it is hard to know the cause. I have found that isolating a line of code that causes the error into a function that returns a boolean works in most cases because you can send the error to a label "eh:" in your function and return false to indicate that the function did not work correctly. I suppose you can have several labels and several goto labels as well. Is that possible? For me, isolating errors prone code into functions helps you ensure you know why your code is breaking and it allows you to control the next step.
Great content! Thank you for sharing your knowledge! My team has quite a few macros. Most of them open log files, read data, validates and extracts data on log files based on the position in the row. Then finally generats ouput files (log file) with the information based on the matched criteria. Most of the times because of extra spaces or characters macro not able to read data on source files (log files) and providing error messages. Could you please upload a video with log files and how to identify source file and the line of souce file where the error coming from? Thank you in advance!
Hey! I've been following your channel for some time now, im from and in Perú, your videos are awesome, I just wanted to ask, in this method, I understand that it's only one error per sub in every run right?
Hi Paul, thanks a lot for your video, they are very useful... just one question please: I checked on my Excel when clicking any module(right click) in my VBA editor, I do not have the option "add line number"... I do not understand, I am currently using Excel 2016... thanks a lot in advance for your feedback...
I listened again your video, you said that you used MZ tool to do that but it is not free...but alternatively it is possible to program something ourselves...
Hi Paul, your tutorials are great! (I always recommend them to my friends). Thanks and keep them coming! Could you assist me to open the .bas file that has the code? Thanks in advance! And Happy Holidays!
Hello how did u update the number to the code automatically, can we able create our own tool, like that as a developer tool to faster the code writing method!
Method 'SaveAs' of object '_Worksheet' failed" sometime , iam getting this error, could you please tell us cause and solve the error You’re invited to try
Can you tell what is error If txt.Value = "" Or txt.Value = Field_Type Then MsgBox "Please enter the " & Field_Type, vbCritical Exit Sub End If
Dim Search_range As Range Set Search_range = sh.Range(sh.Cells(2, Col_number), sh.Cells(Application.Rows.Count, Col_number)) If Application.WorksheetFunction.CountIf(Search_range, "*" & txt.Value & "*") = 0 Then MsgBox "No Match Found", vbCritical Exit Sub End If Dim iRow As Long If Application.WorksheetFunction.CountIf(Search_range, txt.Value) > 0 Then iRow = Application.WorksheetFunction.Match(txt.Value, Search_range, 0) + 1 Else iRow = Application.WorksheetFunction.Match("*", & txt_value & "*", serach_range, 0) + 1 End If
Hello. If i have the next Macro: Sub Copyrenameworksheet() 'Updateby Extendoffice 20160704 Dim ws As Worksheet Set wh = Worksheets(ActiveSheet.Name) ActiveSheet.Copy After:=Worksheets(Sheets.Count) If wh.Range("A1").Value "" Then ActiveSheet.Name = wh.Range("A1").Value End If wh.Activate End Sub Home can i add an MsgBox that write "Sheet already exists"?
Hey Paul, Could you make a video about error handling within a while and for loop. On error do something and then jump to next loop iteration. That would be very helpful :)
Sub Thanks(sReason As String)
Dim NewLine as String
NewLine=vbCrLf
MsgBox("Thank you Sir" & NewLine & sReason)
End Sub
Call Thanks("You saved my life with that piece of code!!!")
Terrific approach, especially as it retraces the entire stack of procedure calls. I've learned so much from subscribing to your channel. Cheers, Brendan
Thanks Brendan
Very useful
You are the best Excel-related RUclipsr. Thank you again. Mary Christmas.
Thanks Ismail
Thank you for the great video. Unfortunately, when i import your fil, it only has the ErrorHandling Module. How do I download the other modules?
This is really good stuff mate, thank you so much!
Thanks for this Paul. I hve learned a lot.
Paul awesome content.
You have given key value on VBA language. We have never come across such a useful error handling procedure.
Merry X'Mas 😄😃😍
Big Thumbs up 👍👍👍
Thanks Hemant
Thank you my friend for the code file. It's great
This the most useful strategy I have found on the internet. Unfortunately, it doesn't seem to work when you use it on userforms. When the error is found inside of a command button of a userform, the code stops where the err.raise line is located. That was very frustrating for me not to be able of using this powerful strategy in my code. Besides that... Thanks very much for your incredible job :)
'Just recently came across your excellent videos, so not sure if you're still reading comments. If so, I've tried a number of ways to implement your error handling code to no avail (put the ErrorHandling module into a sandbox, copied test routines from your website and ran them, but message box with error readout doesn't come up). Is there some way of determining what is missing? I'd love to replace my current, klunkier error handling with this technique. Thx!
Thanks Paul!
Merry X-Mas and an error free 2020!
Many happy returns Archibald.
😆😆😆😆😆😆😆😆😆😆😆 Had an "error free 2020" resolution. All ready broke it.
Excellent video. The problem with throwing errors is that with a large procedural subroutine, it is hard to know the cause. I have found that isolating a line of code that causes the error into a function that returns a boolean works in most cases because you can send the error to a label "eh:" in your function and return false to indicate that the function did not work correctly. I suppose you can have several labels and several goto labels as well. Is that possible? For me, isolating errors prone code into functions helps you ensure you know why your code is breaking and it allows you to control the next step.
Great content! Thank you for sharing your knowledge!
My team has quite a few macros. Most of them open log files, read data, validates and extracts data on log files based on the position in the row. Then finally generats ouput files (log file) with the information based on the matched criteria. Most of the times because of extra spaces or characters macro not able to read data on source files (log files) and providing error messages.
Could you please upload a video with log files and how to identify source file and the line of souce file where the error coming from?
Thank you in advance!
Great video! Can you show how to use named range in vba and how to setup named range?
Thank you Paul sir. Your videos are very informative and it has helped me to purify my codes. 🤗
Thanks a lot Rahul
Hey! I've been following your channel for some time now, im from and in Perú, your videos are awesome, I just wanted to ask, in this method, I understand that it's only one error per sub in every run right?
Yes. But the code will exit at the first error so it wouldn't reach any other errors.
@@Excelmacromastery Niceee
This is awesome 👌
Hi Paul, thanks a lot for your video, they are very useful... just one question please: I checked on my Excel when clicking any module(right click) in my VBA editor, I do not have the option "add line number"... I do not understand, I am currently using Excel 2016... thanks a lot in advance for your feedback...
I listened again your video, you said that you used MZ tool to do that but it is not free...but alternatively it is possible to program something ourselves...
It is possible to write your own code to do it but it's not trivial to do so.
Thank you Paul!!! I need to test it asap.
You are very welcome Michal
Hi Paul, great video. Out of interest, why do you pass the parameters to RaiseError and DisplayError subs as ByVal?
It means that only the value is passed. So if the value is changed in the sub it will be changed in the original.
You make VBA look easy 😃
Thanks George
FYI, I have noticed the link to the code of this video (and some others) takes you to a broken link. Thanks
This was very helpful!
Glad to help
Hi Paul, your tutorials are great! (I always recommend them to my friends). Thanks and keep them coming! Could you assist me to open the .bas file that has the code? Thanks in advance! And Happy Holidays!
Right click on the workbook in the project window. Select "Import File" and then select the .bas file
@@Excelmacromastery Thanks!
Great video! The download link for the error handling code however seems to be dead. I'm just getting a white screen.
This is caused by using a pop up blocker like uBlock Origin. Try turning it off or using incognito.
@@Excelmacromastery I was indeed using ublock. Got it now and working great. Thx
Excellent strategy
Thanks chinmay
Is there any requirement that you add declared constant vbObjectError value + 1
Const Error_Total_Value = vbObjectError + 1
Helpful, thank you
You are very welcome
Hello how did u update the number to the code automatically, can we able create our own tool, like that as a developer tool to faster the code writing method!
I used a third party tool. You can write code to do it but it's advanced.
Does your error handling code work for access vba?
Yes.
Unable to download the code page times out
This site can’t be reached
bit.ly took too long to respond.
I just checked it an it seems fine. Are you using a VPN by any chance?
Great going Paul.
I downloaded the .bas file. How to open it?
No seat Paul. I could open the bas file following your instructions in your email. Thanks a lot for the code, video & everything else.
Thanks Sandeep
Open it with Notepad...
Method 'SaveAs' of object '_Worksheet' failed" sometime , iam getting this error, could you please tell us cause and solve the error
You’re invited to try
one word : Wow
tks :-)
Thanks a lot Mario
Download is not possible, just a blank website.
Make sure to turn off any adblockers
5:03 ?😜
Unexpected laughters... 😂😂😂😂
00:12. Sir Paul recommends viewing the previous video on error handling
ruclips.net/video/gKIOIXriXEI/видео.html
before viewing this video. Do it!
Can you tell what is error
If txt.Value = "" Or txt.Value = Field_Type Then
MsgBox "Please enter the " & Field_Type, vbCritical
Exit Sub
End If
Dim Search_range As Range
Set Search_range = sh.Range(sh.Cells(2, Col_number), sh.Cells(Application.Rows.Count, Col_number))
If Application.WorksheetFunction.CountIf(Search_range, "*" & txt.Value & "*") = 0 Then
MsgBox "No Match Found", vbCritical
Exit Sub
End If
Dim iRow As Long
If Application.WorksheetFunction.CountIf(Search_range, txt.Value) > 0 Then
iRow = Application.WorksheetFunction.Match(txt.Value, Search_range, 0) + 1
Else
iRow = Application.WorksheetFunction.Match("*", & txt_value & "*", serach_range, 0) + 1
End If
Hello. If i have the next Macro:
Sub Copyrenameworksheet()
'Updateby Extendoffice 20160704
Dim ws As Worksheet
Set wh = Worksheets(ActiveSheet.Name)
ActiveSheet.Copy After:=Worksheets(Sheets.Count)
If wh.Range("A1").Value "" Then
ActiveSheet.Name = wh.Range("A1").Value
End If
wh.Activate
End Sub
Home can i add an MsgBox that write "Sheet already exists"?
Hey Paul, Could you make a video about error handling within a while and for loop. On error do something and then jump to next loop iteration. That would be very helpful :)
the website never works !
Which website?
👍🏻
I AM SO stupid I dont understand!!!!😓😓😓😓😓😓