Free Excel VBA Course #22 - Error Handling in VBA (On Error Goto/Resume)

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ก.ย. 2024
  • In this video, I will show you how to handle errors in VBA in Excel.
    VBA has given us some tools and techniques you can use to handle errors and In some cases use these to your advantage.
    There are statements such as On Error Goto or On Error Resume where you can specify what to do in case VBA encounters an error. You can ask the code to jump to a specific line of code or you can ask it to ignore the error and keep moving.
    You can also use message boxes to identify and understand the errors better.
    ✅ VBA Course Download files: trumpexcel.com...
    ☕ If you find my Excel videos useful and would like to support me, you can buy me a coffee - www.buymeacoff...
    Free Excel Course (Basic to Advanced) - trumpexcel.com...
    Best Excel Books: trumpexcel.com...
    Subscribe to get awesome Excel Tips every week: www.youtube.co...
    #Excel #ExcelTips #ExcelTutorial

ความคิดเห็น • 26

  • @Souhila-yi8qk
    @Souhila-yi8qk 4 หลายเดือนก่อน

    Thank you for the interesting Video

  • @nobodyimportant5485
    @nobodyimportant5485 2 ปีที่แล้ว

    Very helpful and concise! Thank you!

  • @douglashaffner1173
    @douglashaffner1173 ปีที่แล้ว

    This is amazing. Has saved me so much pain. Thank you so much

  • @ren_6130
    @ren_6130 2 ปีที่แล้ว

    very comprehensive, thank you!

  • @bhushanpagade8673
    @bhushanpagade8673 3 ปีที่แล้ว +1

    Thank you it helped me a lot.

  • @margad-erdeneboldbaatar4704
    @margad-erdeneboldbaatar4704 2 ปีที่แล้ว

    Thanks so much.

  • @kalkool5504
    @kalkool5504 2 ปีที่แล้ว

    Perfect for me

  • @chenclaire638
    @chenclaire638 2 ปีที่แล้ว

    It helped me a lot, thank you

  • @JATINKUMAR-qu4vi
    @JATINKUMAR-qu4vi 2 ปีที่แล้ว

    Awesome video 👍

  • @rakeshthakur9403
    @rakeshthakur9403 ปีที่แล้ว

    Nice video

  • @bluejay12293
    @bluejay12293 2 ปีที่แล้ว

    thank you

  • @techkdeva8587
    @techkdeva8587 3 ปีที่แล้ว

    Great effort

  • @Vvvvixen
    @Vvvvixen 3 ปีที่แล้ว

    Thank you!

  • @vijaysahal4556
    @vijaysahal4556 4 ปีที่แล้ว

    amazing sir thankx 👍👍👍👍👍👍👍

  • @kaustubhzende3553
    @kaustubhzende3553 ปีที่แล้ว

    how to exit the loop? I have no idea. Eventually i had to end the task via taskmanager. Any feedback is highly appreciated.

  • @redhaakhund1271
    @redhaakhund1271 2 ปีที่แล้ว

    👍👍👍👍👍

  • @ardhik3744
    @ardhik3744 3 ปีที่แล้ว

    can i handle "runtime error 4605" with this method?

  • @surajrawat3152
    @surajrawat3152 2 ปีที่แล้ว

    Can you help me what i am missing out in this code? after debugging showing run time error 13 "Number = InputBox("Enter numeric value")" area
    Sub errorhandling()
    Dim Number As Long
    On Error GoTo EntryError
    Number = InputBox("Enter numeric value")
    Range("A1").Value = Number
    EntryError:
    MsgBox "Please enter valid value"
    End Sub

  • @umamaheshk6151
    @umamaheshk6151 3 ปีที่แล้ว

    In the following, when i run it, it takes alphanumeric value, numeric value, integer value. It didn't show error.
    Can anyone give me what I have done wrong?
    Sub ErrorHandling()
    Dim Emp_Name As String
    EName:
    On Error GoTo NameError
    Emp_Name = InputBox("Please Enter Employee Name")
    Range("b2") = Emp_Name
    Exit Sub
    NameError:
    MsgBox "Please Enter Numeric Value Only"
    Resume EName
    End Sub

    • @andrewtuinkwtuink
      @andrewtuinkwtuink 3 ปีที่แล้ว +1

      I think you need to put '.Value' after the Range("B2").

    • @umamaheshk6151
      @umamaheshk6151 3 ปีที่แล้ว

      @@andrewtuinkwtuink I also used ".value" but same error

    • @andrewtuinkwtuink
      @andrewtuinkwtuink 3 ปีที่แล้ว +1

      @@umamaheshk6151 Employee name supposed to be Alphabeth right? String could handle alphabeth and number. If You want number only, You could use long.
      If this still give different results, wish someone notice this and give the right answer.

    • @umamaheshk6151
      @umamaheshk6151 3 ปีที่แล้ว

      @@andrewtuinkwtuink Yes. But I want only alphabets in Name, then what I have to do?

    • @andrewtuinkwtuink
      @andrewtuinkwtuink 3 ปีที่แล้ว

      @@umamaheshk6151 This solution from Warship at mrexcel
      Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
      If (KeyAscii < 65 Or KeyAscii > 90) And (KeyAscii < 97 Or KeyAscii > 122) Then KeyAscii = 0

      End Sub