Excel runtime error -2147417848 (800810108)

dolphinrob

New Member
Joined
Mar 2, 2009
Messages
2
Hi, during work I use a Excel file with VBA. This file has been created by a person who earlier worked at our firm. This means that I doesnt have great knowledge regarding VBA.

After some adaptions of the file a macro which earlier worked now gives an error message.

The error is in a repeating (about 20x) macro part of another macro to fill a sheet with data.

The error is given by ActiveSheet.Paste.
I suspect that the error is due to "Begindem" which is changed position in worksheet after every paste (1 paste is being executed before error is given). The error message is: runtime error -2147417848 (80010108) method 'paste' of object '-worksheet; failed.

Sheets("Dtotal").Select
Range("Begindem").Select
ActiveSheet.Paste
Regels = Selection.Address(ReferenceStyle:=xlA1)
If Len(Regels) < 10 Then
laatste = Right(Regels, 1)
Else
If Len(Regels) < 12 Then
laatste = Right(Regels, 2)
Else
If Len(Regels) < 14 Then
laatste = Right(Regels, 3)
Else
laatste = Right(Regels, 4)
End If
End If
End If
Range("A" & laatste + 1).Select
ActiveWorkbook.Names.Add Name:="Begindem", RefersToR1C1:=Selection
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell

Hopefully someone can help me to solve this issue!

Thanks in advance
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Maybe just change:
Code:
ActiveWorkbook.Names.Add Name:="Begindem", RefersToR1C1:=Selection

To:
Code:
Selection.Name = "Begindem"

I think the former isn't quite giving Excel the new range address properly.

Alex
 
Upvote 0
Hi,

I tried to change but still the same error occurs regretfully.
So hopefully you have more suggestions?

Regards
Rob
 
Upvote 0
Hmm,
Maybe there's nothing to "paste" anymore...
Shouldn't there be a "copy" somewhere before this paste... (?)

What is it supposed to paste here?

Alex.
 
Upvote 0

Forum statistics

Threads
1,203,400
Messages
6,055,179
Members
444,768
Latest member
EMGVT

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