Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quotation Marks as Text Kelly C Excel Discussion (Misc queries) 2 August 3rd 08 06:20 PM
Generating text surrounded by quotation marks AaronQRules (a.k.a. Jeff) Excel Discussion (Misc queries) 5 July 30th 07 08:12 PM
Inserting Quotation Marks in all Cells confused Excel Discussion (Misc queries) 4 October 19th 05 01:49 PM
After exporting how do I remove quotation marks from text cells Marty G Excel Discussion (Misc queries) 0 July 29th 05 02:54 AM
How do I concatenate text that actually contains quotation marks? Excel Distress Excel Worksheet Functions 3 April 15th 05 02:23 PM


All times are GMT +1. The time now is 03:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"