Possible problem regarding the response from user user3616725:
Im on Windows 8.1 and there seems to be a problem with the associated VBA code with the accepted answer from "user3616725":
Sub CopyCellContents() ' !!! IMPORTANT !!!: ' CREATE A REFERENCE IN THE VBE TO "Microsft Forms 2.0 Library" OR "Microsft Forms 2.0 Object Library" ' DO THIS BY (IN VBA EDITOR) CLICKING TOOLS -> REFERENCES & THEN TICKING "Microsoft Forms 2.0 Library" OR "Microsft Forms 2.0 Object Library" Dim objData As New DataObject Dim strTemp As String strTemp = ActiveCell.Value objData.SetText (strTemp) objData.PutInClipboard End Sub
Details:
By executing over the code and pasting the clipboard into the cell in Excel, I get two characters consisting of squares with a question mark inside, for example: ⍰⍰. Paste in Notepad does not even show anything.
Decision:
After quite a long search, I found another VBA script from the user "Nepumuk" who uses the Windows API . Here is his code that finally worked for me:
Option Explicit Private Declare Function OpenClipboard Lib "user32.dll" ( _ ByVal hwnd As Long) As Long Private Declare Function CloseClipboard Lib "user32.dll" () As Long Private Declare Function EmptyClipboard Lib "user32.dll" () As Long Private Declare Function SetClipboardData Lib "user32.dll" ( _ ByVal wFormat As Long, _ ByVal hMem As Long) As Long Private Declare Function GlobalAlloc Lib "kernel32.dll" ( _ ByVal wFlags As Long, _ ByVal dwBytes As Long) As Long Private Declare Function GlobalLock Lib "kernel32.dll" ( _ ByVal hMem As Long) As Long Private Declare Function GlobalUnlock Lib "kernel32.dll" ( _ ByVal hMem As Long) As Long Private Declare Function GlobalFree Lib "kernel32.dll" ( _ ByVal hMem As Long) As Long Private Declare Function lstrcpy Lib "kernel32.dll" ( _ ByVal lpStr1 As Any, _ ByVal lpStr2 As Any) As Long Private Const CF_TEXT As Long = 1& Private Const GMEM_MOVEABLE As Long = 2 Public Sub Beispiel() Call StringToClipboard("Hallo ...") End Sub Private Sub StringToClipboard(strText As String) Dim lngIdentifier As Long, lngPointer As Long lngIdentifier = GlobalAlloc(GMEM_MOVEABLE, Len(strText) + 1) lngPointer = GlobalLock(lngIdentifier) Call lstrcpy(ByVal lngPointer, strText) Call GlobalUnlock(lngIdentifier) Call OpenClipboard(0&) Call EmptyClipboard Call SetClipboardData(CF_TEXT, lngIdentifier) Call CloseClipboard Call GlobalFree(lngIdentifier) End Sub
To use it the same way as the first VBA code above, change the Sub "Beispiel ()" to:
Public Sub Beispiel() Call StringToClipboard("Hallo ...") End Sub
To:
Sub CopyCellContents() Call StringToClipboard(ActiveCell.Value) End Sub
And run it through the Excel macro menu, as suggested from "user3616725" from the accepted answer:
Go back to Excel, go to Tools> Macro> Macros and select a macro called CopyCellContents, and then select Options in the dialog box. So you can assign a macro to a shortcut key (for example, Ctrl + c for normal copy) - I used Ctrl + q.
Then, when you want to copy one cell to notepad / anywhere, just do Ctrl + q (or whatever you selected), and then do Ctrl + v or Edit> Paste to the selected destination.
Edit (November 21, 2015):
@ comment from "dotctor":
No, this is not a serious new question! In my opinion, this is a good addition to the accepted answer, as my answer solves the problems that you may encounter when using the code from the accepted answer. If I had a great reputation, I would create a comment.
@ comment from "Teepeemm":
Yes, you are right, the answers beginning with the heading "Problem:" are misleading. Changed: “Possible problem regarding the response from user user3616725”: “. Of course, as a comment, I would write much more compact.