Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
search for text "beginning with" "containing" wildcards | Excel Worksheet Functions | |||
in Excel: How do I change "selected cells" highlight color? | New Users to Excel | |||
create macro "merge selected cells"? | Excel Programming | |||
Create a "cell button" to hide selected cells. | Excel Worksheet Functions | |||
Macro to take selected cells times a selected cell | Excel Programming |