MS Excel 2010 or 2007 or any version for that matter when you copy a cell(not selecting text from the cell) and pasting to any editor adds a line break and sends the cursor to next line. Its annoying to move up the cursor back to last line.
It doesnt look much work to get the cursor back to last line but if you have to keep doing this a lot of times as a programmer i feel really bad. Any suggestions if there is a setting in excel to stop this?
I tried looking online didnt find any thing and also looked up the options of excel, didnt find anything.
You can create your own copy routine, that does not store the whole cell, but only its value in the clipboard:
To be able to compile the macro, you need to include "Microsoft Forms 2.0 Object Library" as a reference (in the Visual Basic editor, go to Tools->References and browse
%windir%\system32forFM20.dll1).You can now either assign this macro to another shortcut (e.g. Ctrl–Shift–C) using the default run macro dialog – or even overwrite Ctrl–c by executing
Application.OnKey "^c", "OwnCopy". However, I’d not recommend overwriting Ctrl–c as you’ll most likely want to use all the other information that usually is copied with it in any other case than pasting to an editor.To make this permanent, just store the macro in your Personal Workbook.
In case you want a more sophisticated copy routine that can also handle multiple cells/selection areas, use this code:
1 In actuality this file exists at
%ProgramFiles%\Microsoft Office\root\vfs\System– Office does some virtualisation trickery to make it appear where it does.