Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Modification in Excel

Status
Not open for further replies.

Bass71

MIS
Jun 21, 2001
79
Hello:

I am trying to add characters(a double quote) to the beginning and the end of a text string in an excel cell, assuming certain conditions are met. I'm not sure if I have to use the Left/Right Functions or some derivation of what I have attempted below:

If ActiveCell.Value <> &quot;&quot; Then
ActiveCell.Value = &quot;&quot;&quot; & ActiveCell.Value & &quot;&quot;&quot;
End If

Thanks so much...................RO
 
You need to double up quotes in strings delimeted by the same type of quote....

ActiveCell.Value = &quot;&quot;&quot;&quot; & ActiveCell.Value & &quot;&quot;&quot;&quot;

Or use single quote delimeted strings:

ActiveCell.Value = '&quot;' & ActiveCell.Value & '&quot;'


I stick to the former because two single quotes for one single quote in a single quote delimeted string can look like a double quote and really confuse matters <as if talking about it doesn't>.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top