Jump to content
Macro Express Forums

Stop macro blank line


Recommended Posts

I assume you mean the selection range could be larger than the actual propagated range in Excel. If this is the case I would create variables for the carriage return and line feed non-printing characters and suck the clip into a variable and find the position of CRLFCRLF (Back to back CRLF) and copy everything before that to the same variable and paste that.

Variable Set to ASCII Char 9 to %Tab%
Variable Set to ASCII Char 10 to %LF%
Variable Set to ASCII Char 13 to %CR%
Variable Set String %Clip% from the clipboard contents
Variable Set Integer %Position% to the position of "%CR%%LF%%CR%%LF%" in %Clip%
Variable Modify Integer %Position%: Decrement
Variable Modify String: Copy a substring in %Clip%, starting at 1 and %Position% characters long to %Clip%
Variable Modify String: Save %Clip% to the clipboard

 

<VARIABLE SET TO ASCII CHAR Value="9" Destination="%Tab%"/>
<VARIABLE SET TO ASCII CHAR Value="10" Destination="%LF%"/>
<VARIABLE SET TO ASCII CHAR Value="13" Destination="%CR%"/>
<VARIABLE SET STRING Option="\x02" Destination="%Clip%" NoEmbeddedVars="FALSE"/>
<VARIABLE SET INTEGER Option="\x0E" Destination="%Position%" Text_Variable="%Clip%" Text="%CR%%LF%%CR%%LF%" Ignore_Case="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x08" Destination="%Position%"/>
<VARIABLE MODIFY STRING Option="\x09" Destination="%Clip%" Variable="%Clip%" Start="1" Count="%Position%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x10" Destination="%Clip%" NoEmbeddedVars="FALSE"/>

Link to comment
Share on other sites

So you are copying one at a time? If so you can do something similar. First off you need to realize that in many apps if you execute a copy command and there's nothing to copy it does not replace what's on the clipboard so clear your clipboard to be safe. But in Excel an empty cell copy converted to text is nothing but a EoL (End of Line) which is made up of two non-printing characters Carriage Return 0x0d and Line Feed 0x0a. What you could do it like in my previous example set a variable to the contents of the clipboard and if it equals EoL then abort. Alternatively you can trim (removes all leading and trailing non-printing characters) the variable and if the variable is empty then abort.

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.

Guest
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.

Loading...
×
×
  • Create New...