Jump to content
Macro Express Forums

SubString Search & Replace


Recommended Posts

Hello All..


I'm new at this, so any help would be greatly appricated. I have a excel worksheet that has rows (cells) in a column with a person's name. such as "Tom Delios"


I would like to know how grab the first letter in the cell of 'Tom Delios', search for the space, and grab the remaining text after the space and concantenate them together to make up "TDelios" and replace "Tom Delios" in the cell with "TDelios"


any help would be greatly appricated




Link to comment
Share on other sites

First you need to get the information from the cell into a Text variable. There are several ways to do this. If you want to do once conversion at a time then you could copy the cell information into the clipboard and then copy from the clipboard into a variable. Something like this:

Text Type: <CTRLD>c<CTRLU>
Variable Set String %T1% from Clipboard

Or, if you want to convert every cell in a file you could export the file to a .csv (comma separated values) format and use the ASCII File Begin Process and ASCII File End Process commands.


Once the information is in the variable this code will strip off the second letter up to and including the space:

Variable Set Integer %N1% from Position of Text in Variable %T1%
Variable Modify Integer: Dec (%N1%)
Variable Modify String: Delete Part of %T1%

To try it highlight this, copy to the clipboard and paste it into your macro.

<IVAR2:01:13:1: ><NMVAR:09:01:0:0000001:0:0000000><TMVAR2:11:01:00:002:N01:>

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