![]() |
Single quotation mark prefix
Hello,
Could some one please help me with the following? In column B of my workbook, I have a list of text data (5500 lines) - an example of this is given below. I wish to prefix each data value with a single quotation mark as shown below, but I do not know how to do this. Cell B2: ABC123-UYT Cell B3: 001HF-367 Cell B4: 00001-KML-8741 I need to change the above to this: Cell B2: 'ABC123-UYT Cell B3: '001HF-367 Cell B4: '00001-KML-8741 Any help would be greatly appreciated. Thanks, Chris. *** Sent via Developersdex http://www.developersdex.com *** |
Single quotation mark prefix
Select the cells you want to convert and run:
Sub dont_quote_me() apos = Chr(39) For Each r In Selection r.Value = apos & apos & r.Value Next End Sub Note that you need two single quotes, not just one. -- Gary''s Student - gsnu2007d "Chris Hankin" wrote: Hello, Could some one please help me with the following? In column B of my workbook, I have a list of text data (5500 lines) - an example of this is given below. I wish to prefix each data value with a single quotation mark as shown below, but I do not know how to do this. Cell B2: ABC123-UYT Cell B3: 001HF-367 Cell B4: 00001-KML-8741 I need to change the above to this: Cell B2: 'ABC123-UYT Cell B3: '001HF-367 Cell B4: '00001-KML-8741 Any help would be greatly appreciated. Thanks, Chris. *** Sent via Developersdex http://www.developersdex.com *** |
Single quotation mark prefix
Use two single quotations...
Mark Ivey "Chris Hankin" wrote in message ... Hello, Could some one please help me with the following? In column B of my workbook, I have a list of text data (5500 lines) - an example of this is given below. I wish to prefix each data value with a single quotation mark as shown below, but I do not know how to do this. Cell B2: ABC123-UYT Cell B3: 001HF-367 Cell B4: 00001-KML-8741 I need to change the above to this: Cell B2: 'ABC123-UYT Cell B3: '001HF-367 Cell B4: '00001-KML-8741 Any help would be greatly appreciated. Thanks, Chris. *** Sent via Developersdex http://www.developersdex.com *** |
Single quotation mark prefix
Thanks Gary for your reply - just a question please - why do I need
quote: Note that you need two single quotes, not just one. Unquote.? A single quotation mark seems to work fine - so will your code work OK to produce a single quotation mark? Thanks, Chris. *** Sent via Developersdex http://www.developersdex.com *** |
Single quotation mark prefix
If you select a cell and manually type two single quotes and the text
APPLES the formula bar will show both quotes, but the cell only one. Excel treats the first single quote as a special text marker and not as part of the string. -- Gary''s Student - gsnu2007d "Chris Hankin" wrote: Thanks Gary for your reply - just a question please - why do I need quote: Note that you need two single quotes, not just one. Unquote.? A single quotation mark seems to work fine - so will your code work OK to produce a single quotation mark? Thanks, Chris. *** Sent via Developersdex http://www.developersdex.com *** |
Single quotation mark prefix
Thanks again Gary - much appreciated.
Cheers, Chris. *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 05:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com