Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Macro to add the " symbol to the beginning and end of cells selected

Dear All

I hope someone can assist.

I am trying to add the " symbol to the beginning and end of my cell
values.

I have dates in some of the columns so I do not want any of the
formatting changed.

For example in cell A1 I have apple. I would like this to read
"apple" or in cell B1 I have the date 29-Feb-2008. I would like this
to read "29-Feb-2008"

Hope you help and thanks in advance,

Stuart
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro to add the " symbol to the beginning and end of cells selected

You could use a macro:

Option Explicit
Sub Testme()
Dim myRng As Range
Dim myCell As Range

Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Selection, _
Selection.Cells.SpecialCells(xlCellTypeConstants))
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "Please select a nicer range!"
Exit Sub
End If

For Each myCell In myRng.Cells
myCell.Value = Chr(34) & myCell.Text & Chr(34)
Next myCell
End Sub


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Stuart wrote:

Dear All

I hope someone can assist.

I am trying to add the " symbol to the beginning and end of my cell
values.

I have dates in some of the columns so I do not want any of the
formatting changed.

For example in cell A1 I have apple. I would like this to read
"apple" or in cell B1 I have the date 29-Feb-2008. I would like this
to read "29-Feb-2008"

Hope you help and thanks in advance,

Stuart


--

Dave Peterson
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
search for text "beginning with" "containing" wildcards David H Excel Worksheet Functions 1 January 13th 10 01:24 PM
in Excel: How do I change "selected cells" highlight color? flameretired New Users to Excel 5 June 24th 09 08:39 PM
create macro "merge selected cells"? Mamoudou Excel Programming 7 December 22nd 07 10:57 PM
Create a "cell button" to hide selected cells. Shoolin Patel Excel Worksheet Functions 12 July 30th 07 11:00 AM
Macro to take selected cells times a selected cell Craig Excel Programming 4 October 24th 05 12:54 AM


All times are GMT +1. The time now is 12:46 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"