ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adding an apostrophe (https://www.excelbanter.com/excel-discussion-misc-queries/16816-adding-apostrophe.html)

Jeff

Adding an apostrophe
 
I need help to run a formula that would replace the value of the cells
K10:K500 by adding an apostrophe €˜ in each row in column K

Example row K9: is 01/20/2005 needs to be €˜01/20/2005.

Regards,


Jim Rech

A formula cannot change other cells, it just returns a result to the cell it
is in. Maybe you meant a macro? This works on the range selected .

Sub DoConvertToText()
Dim Cell As Range
Dim Counter As Long
''Special cell works on the entire current region if only one cell is
selected
If Selection.Cells.Count = 1 Then
If ActiveCell.Value < "" And Left(ActiveCell.Formula, 1) < "="
Then
ActiveCell.Value = "'" & ActiveCell.Value
MsgBox "One cell converted to text"
End If
Else
On Error GoTo NoCells
For Each Cell In Selection.SpecialCells(xlCellTypeConstants)
Cell.Value = "'" & Cell.Value
Counter = Counter + 1
Next
MsgBox Counter & " cells were converted to text"
End If
Exit Sub
NoCells:
MsgBox "No cells with constants were found"
End Sub

--
Jim Rech
Excel MVP
"Jeff" wrote in message
...
|I need help to run a formula that would replace the value of the cells
| K10:K500 by adding an apostrophe ' in each row in column K
|
| Example row K9: is 01/20/2005 needs to be '01/20/2005.
|
| Regards,
|



CLR

With your present dates in K1:K500, use a helper column , say column J and
put this formula in J10 and copy down.........then do Copy PasteSpecial
Values on column J and then copy and paste it over to column K to replace
your dates without the apostrophe.

="'"&MONTH(K10)&"/"&DAY(K10)&"/"&YEAR(K10)

Vaya con Dios,
Chuck, CABGx3


"Jeff" wrote in message
...
I need help to run a formula that would replace the value of the cells
K10:K500 by adding an apostrophe ' in each row in column K

Example row K9: is 01/20/2005 needs to be '01/20/2005.

Regards,





All times are GMT +1. The time now is 05:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com