Jump to content
Macro Express Forums

Excel - Paste from Clipboard goes on 2 rows


Recommended Posts

When I paste from the clipboard into a cell, it pastes text up to a variable then drops down to the next cell and pastes the rest of the text.


In the example below:

T35 = Jun

T3 = %35% Rev = Jun Rev


"Jun" is printed in one cell (A1) and "REV" prints in the cell below it (A2). It is all supposed to print in one cell (A1)


<TVAR2:03:01:%T35% Rev><TMVAR2:16:03:00:000:000:><CLIPP>


Another clue - when this is run as a standalone macro it puts all in one cell. When it is part of the macro I am working on, it puts it in two cells. The same code with two different results!


Jun Rev







Win 2000/Office 2000

Link to comment
Share on other sites

I'm guessing that the first bit of text is being copied from a cell. If you bring that into a text var it puts a CRLF at the end. That's a Carriage Return and a Line Feed Which is used to signify the end of a line. When combined as you have done it would cause Excel to think that there are two cells of data in two rows and thats how it pastes it. If this is the case after you copy your first cell and convert it to a string var try issuing the trim command on it. This will trim any nonprinting characters off the var.



BTW this is actually a handy feature. When you copy ranges of cells in this way they become tab separated values. Like a CSV but with tabs. You can use this to process the blocks like with the ASCII File Process command. It's very handy!


Oh, and this is a easy quick way yo get data back into Excel. Seperate your columns with tabs and rows with CRLF and you can paste it all in as one big block in one operation!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...