Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to place quotation marks before and after text in all cells
It seems really simple. I tried to do a simple find and replace using * as a
wildcard, but it didn't work. All I need to do is get quotation marks before and after the text in each cell of each row. I know there is a simple solution out there. Any help would be greatly appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to place quotation marks before and after text in all cells
Range("A1") = """" & Range("A1") & """"
You need to have two double quote in a row for it to be displayed as a double quote So instead of "a" as a string the a would be replace by two double quotes. another method is to use chr(34) Range("A1") = chr(34) & Range("A1") & chr(34) "suestew" wrote: It seems really simple. I tried to do a simple find and replace using * as a wildcard, but it didn't work. All I need to do is get quotation marks before and after the text in each cell of each row. I know there is a simple solution out there. Any help would be greatly appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to place quotation marks before and after text in all cells
Here is a macro to try. Select the range on your worksheet that needs quoted
text. Sub TextQuotes() ' Quotes around text ' First select the range to put quotes around ' Dim c As Range For Each c In Selection c = """" & c.Value & """" Next End Sub Sub RemoveTextQuotes() ' Removes quotes around text ' First select the range to remove quoted text ' Dim c As Range For Each c In Selection If Left(c.Value, 1) = """" And Right(c.Value, 1) = """" Then c.Formula = Mid(c.Value, 2, Len(c.Value) - 2) End If Next End Sub "suestew" wrote: It seems really simple. I tried to do a simple find and replace using * as a wildcard, but it didn't work. All I need to do is get quotation marks before and after the text in each cell of each row. I know there is a simple solution out there. Any help would be greatly appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Quotation Marks as Text | Excel Discussion (Misc queries) | |||
Generating text surrounded by quotation marks | Excel Discussion (Misc queries) | |||
Inserting Quotation Marks in all Cells | Excel Discussion (Misc queries) | |||
After exporting how do I remove quotation marks from text cells | Excel Discussion (Misc queries) | |||
How do I concatenate text that actually contains quotation marks? | Excel Worksheet Functions |