I have a macro I use for pasting in excel it works fine except when copy and pasting from one cell to another. In other words it works fine with say text from a webpage but not from one cell to another. The error message says Run time error '1004': PasteSpecial method of Worksheet class failed.
Here is the code:
Sub MousePaste()
'
' MousePaste Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
ActiveCell.Select
ActiveSheet.PasteSpecial Link:=False, DisplayAsIcon:= _
False, NoHTMLFormatting:=True
End Sub
There are two implementations of a PasteSpecial method.
Worksheet.PasteSpecial which pastes from the clipboard and
Range.PasteSpecial which pastes from/to a range.
You probably need the latter, examples in the above links.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.