Weird problem with cut/paste in a macro

whiteghost

Well-known Member
Joined
Nov 22, 2002
Messages
500
Code:
Columns(E:E).EntireColumn.Autofit
Range ("d3:d8")
Selection.Cut
Range("E3").Select
Activesheet.paste

This code works, except for when it is used by my colleague in Vietnam, where it causes the runtime error '-2147417848(80010108)'
Method 'Paste'of object '-Worksheet' failed.

The code simply cuts a range and pastes it to another column. Also other macros wihich do similar operations work perfectly (I'm guessing that this rules out variations in separators is a at fault) Can anyone give a suggestion on how to get round this or even just what the runtime error is

:rolleyes:
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Columns(e:e) must be converted to columns(5)
and add select in Range ("d3:d8") like range("d3:d8").select
 
Upvote 0
hi Chitosunday,

thanks, but changing from Columns ("E:E") to columns(5) would have not have made any difference Other macros copy/paste complete columns using alphabetic references and they were not afftected.

I think I have found the problem. When re writing one of the other macros, I deleted the line "Activesheet.unprotect", which meant the area that was being pasted to was protected. :oops:

I shall now go away, resolve to be more careful next time, get embarrassed at not noticing the error earlier and get blind drunk.
 
Upvote 0
Here are some more things you can "get embarrassed at" :-

This code works

Impossible. Even outside of Vietnam.

thanks, but changing from Columns ("E:E") to columns(5) would have not have made any difference

True. But your post didn't have Columns ("E:E")

Range ("d3:d8")

This line of code will cause an "Invalid use of Property" message and the macro cannot be run.
 
Upvote 0
okay Ponsy I done a typo by missing .select at the end of that line
Duh!!! youse never dun dat?
and I did mention "E:E"
where did you put yer glasses when you read the post?

and Kirsty will probably move this to the lounge after this post.... or Nate will


flame on bro
 
Upvote 0
okay Ponsy I done a typo by missing .select at the end of that line
Duh!!! youse never dun dat?

No. I's never dun dat. It might happen one day - but it's unlikely.

and I did mention "E:E"
where did you put yer glasses when you read the post?

The place in which I put my glasses (spectacles, I assume ) is irrelevant.
Youse did mention "E:E" but that wuz subsequent to the relevant period during which youse original mention of E:E wuz relevant (i.e. the period between your original post where you mentioned E:E and your subsequent post where you decided to change it to "E:E").


If recriminations are Due, Lay it on me.
 
Upvote 0
whiteghost said:
okay Ponsy I done a typo by missing .select at the end of that line
Duh!!! youse never dun dat?
and I did mention "E:E"
where did you put yer glasses when you read the post?

and Kirsty will probably move this to the lounge after this post.... or Nate will

flame on bro
I thought your drinking activity was to follow your posting here... What does flame on bro mean? :whistle:

Perhaps when you sober up, see what your associate makes of the following:
Code:
Sub a(): [d3:d8].Cut [e3]: [e1].EntireColumn.AutoFit: End Sub
Your error number is a dubious one. Makes me wonder how the procedure is called, perhaps with a Control that takes focus, in say Excel '97...
 
Upvote 0

Forum statistics

Threads
1,203,067
Messages
6,053,334
Members
444,654
Latest member
Rich Cohen

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