Runtime error '-2147417848 (80010108)'

wolf_m70 -  
wolf_m70 Posted messages 3 Status Member -
Hello everyone.

I'm here to ask for help with an Excel project.

First of all, please know that I'm a beginner in this area.

As part of my work, I need to create a file to enter client records, customer orders, and supplier orders.

I have created three forms to input this data.

Everything was working fine until an error appeared:

Runtime error '-2147417848 (80010108)'
The '_Default' method of the 'Range' object failed

Runtime error '-2147417848 (80010108)'
Automation error
The invoked object has disconnected from its clients.

Here is one of my codes to enter the data. All other codes were based on the same model. For confidentiality reasons, I have modified the name of the text boxes.

Sub
Application.ScreenUpdating = False

Sheet3.Activate
Range("A1").Select

Selection.End(xlDown).Select

Selection.Offset(1, 0).Select

ActiveCell = TextBox1.Value

ActiveCell.Offset(0, 1).Value = TextBox2
ActiveCell.Offset(0, 2).Value = TextBox3
ActiveCell.Offset(0, 3).Value = TextBox4
ActiveCell.Offset(0, 4).Value = TextBox5
ActiveCell.Offset(0, 5).Value = TextBox6
ActiveCell.Offset(0, 6).Value = TextBox7
ActiveCell.Offset(0, 7).Value = ComboBox1
ActiveCell.Offset(0, 8).Value = TextBox8
ActiveCell.Offset(0, 9).Value = TextBox9

Unload Me

MsgBox "Your order has been successfully recorded", vbOKOnly + vbInformation, "Confirmation"

End Sub

The error occurs on the line "ActiveCell = TextBox1.Value"

I have already tried replacing the text boxes with new ones, but that didn't work.

Can you please help me??

Thank you in advance,

Have a nice day everyone! :)

2 answers

  1. ccm81 Posted messages 11033 Status Member 2 434
     
    Hello

    Try it like this

    Sheet3.Activate With Sheet3.Range("A1").Select Selection.End(xlDown).Select Selection.Offset(1, 0).Select ActiveCell.Value = TextBox1.Value ... End With

    Best regards
    0
    1. wolf_m70
       
      Hello ccm81,

      Thank you for your response, but unfortunately, it still doesn't work..
      The file throws the same error at the same spot

      Best regards
      0
    2. wolf_m70 Posted messages 3 Status Member
       
      Hello everyone,

      For those who are in the same situation as me and can't find an answer online:

      I discovered that when the file throws an error, instead of clicking on "Debug," if I click on "End," the macro works, so my data is entered.

      When I realized this, I immediately ran my macro again, and this time it worked without even showing me the error message, and this for all my forms.

      It works until I close the file. When I reopen the file, the first time I run the macro, it starts over again. But when I repeat these steps, everything works normally.

      I won't hesitate to let you know if I finally fix the error permanently, but for now, I will have to make do with this workaround!

      Thanks again to ccm81 for trying to help me solve my problem :)

      Good luck to you all!
      0
      1. Frenchie83 Posted messages 2254 Status Member 339 > wolf_m70 Posted messages 3 Status Member
         
        Hello,

        Question: Where did you place this macro? In which module?
        Because I placed it in the userform module and tried it, it works well.

        Best regards
        0
      2. wolf_m70 Posted messages 3 Status Member > Frenchie83 Posted messages 2254 Status Member
         
        Hello,

        My macro is linked to my "validate" button in the userform.

        It was working perfectly at first. Then, I continued to make progress on the project and nothing worked anymore.

        After several attempts, the error doesn’t even appear anymore, without me having to do anything.

        I had tried to create a macro that allowed me to extract my data into another file for archiving. I think it might be this link between two files that caused the issue, but the error didn't show up immediately and wasn't even on the "extraction" macro, so I'm not really sure...

        Thank you for your help Frenchie83

        Best regards
        0
  2. ccm81 Posted messages 11033 Status Member 2 434
     
    And by specifying the name of the form?
    ActiveCell.Value = UserForm1.TextBox1.Value

    https://mon-partage.fr/f/B8H9ogeb/

    Best regards
    0
    1. wolf_m70 Posted messages 3 Status Member
       
      Thank you, but it still doesn't work.. :(

      Best regards
      0