Method 'Insert' of object 'Range' failed - Run-time error '-2147417848 (80010108)':

ksmith59

New Member
Joined
Nov 16, 2016
Messages
1
Hi, I'm using Windows 10 Pro and Excel 2010 pro and the following VBA code shown below in four of the sheets in my workbook. It had been working great since i created the Workbook several months ago.... i.e. when a date is entered in a cell within the range named "rngTrigger", the entire row of the particular cell where the date is entered is automatically cut and pasted into a different worksheet named"PSWS Closed Out Plans".
However, now, whenever a date is entered in one of the "rngTrigger" cells, the VBA error listed in the title above appears and Excel proceeds to freeze up and needs to be manually shut down using task manager.

There are three other team members of mine who also use this workbook and Excel 2010 pro and they are experiencing the same error/problem. The Workbook is protected and shared however NONE of the worksheets are protected. I tried unprotecting the workbook to see if this was the issue however continued to encounter the same error afterwards.

Can anyone please explain to me exactly what i need to change in the code below to fix the problem and stop the error from occurring?

Please note: I did not create but found this code with the help of Google and am a novice at best when it comes to using Macros/VBA.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDest As Range
Set rngDest = Worksheets("PSWS Closed Out Plans").Range("rngDest")
 
' Limit the trap area to range of cells in which completed dates are entered as defined above
If Not Intersect(Target, Range("rngTrigger")) Is Nothing Then
 
' Only trigger if the value entered is a date or is recognizable as a valid date
     If IsDate(Target) Then
'Ensure subsequent deletion of 'moved' row does NOT cause the Change Event to run again and get itself in a loop!
        Application.EnableEvents = False
        Target.EntireRow.Select
        Selection.Cut
        rngDest.Insert Shift:=xlDown
        Selection.Delete
' Reset EnableEvents
        Application.EnableEvents = True
    End If
End If
 
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Re: HELP: Method 'Insert' of object 'Range' failed - Run-time error '-2147417848 (80010108)':

Try this and see if it helps (you need to replace 'ThisWorkbook.name' with the correct name of the workbook)
Dim appXL as Excel.Application
Dim rngDest As Excel.Range
set appXL = Getobject(,"Excel.Application")
Set rngDest = appXL.Workbooks(ThisWorkbook.name).Worksheets("PSWS Closed Out Plans").Range("rngDest")
 
Upvote 0

Forum statistics

Threads
1,216,146
Messages
6,129,142
Members
449,488
Latest member
qh017

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