How Can We Help?
< All Topics

Using Excel and the clipboard

If a macro copies the content of a cell in Excel to the clipboard and then copies the clipboard to a variable, comparing the content of the variable with an ‘If Variable =’ (equals) command will fail. The reason is that Excel copies additional, unexpected characters to the clipboard. The additional characters consist of a newline or, in other words, a carriage return followed by a line feed.

To fix this in your macro, insert a ‘Variable Modify String: Trim’ command after copying information from a cell in Excel via the clipboard. Highlight a cell in Excel and run these macro commands:

Clipboard Copy
Variable Set String %T1% from Clipboard
Variable Modify String: Trim %T1%

– Applies to: Macro Express and Macro Express Pro