Hello,
Thanks for reaching out to Microsoft Q&A forum support.
I understand you are experiencing a runtime error -2147417848 (80010108) when attempting to insert a row in an Excel sheet using VBA.
This error often arises when Excel is in an inconsistent state, especially after duplicating workbooks or modifying named ranges. In your case, changing the "keys" range from ES242501 to SL252601 may have introduced a reference or context issue that affects the Insert method.
To resolve this issue, please follow the steps below:
1. Ensure Excel is not in Edit Mode or Active Cell State Before running the macro, make sure no cell is actively being edited or selected in a way that could interfere with VBA execution.
This helps prevent Excel from locking the sheet context during macro execution.
2. Explicitly Activate the Target Sheet Before Inserting
For instance, modify your code to activate the sheet before performing the insert operation:
Sheets("BDPAGOS").Activate
Sheets("BDPAGOS").Range("C3").EntireRow.Insert
Activating the sheet ensures that the VBA context is correctly aligned with the target worksheet.
3. Test in a New Workbook
Copy your VBA code and form into a fresh workbook and test the macro.
This isolates the issue and confirms whether the error is workbook specific.
Best wishes,
Peter | Microsoft Q&A Support Moderator