Insert apostrophe in each cell
On Tue, 4 Mar 2008 07:53:01 -0800, Shari
wrote:
I was told to put it in front of each entry.
Also, the other formulas I was given are not working.
Use this macro.
To enter the macro, <alt-F11 opens the VBEditor. Ensure your project is
highlighted in the Project Explorer window, then Insert/Module and paste the
code below into the window that opens.
To use the macro, select any cell in the column to be processed.
Then, <alt-F8 opens the Macro Dialog box. Select InsertApostrophe and <RUN.
===============================
Option Explicit
Sub InsertApostrophe()
Dim lLastRow As Long
Dim rCol As Range
Dim lCol As Long
Dim c As Range
lCol = Selection.Column
lLastRow = Cells(65536, lCol).End(xlUp).Row
Set rCol = Range(Cells(1, lCol), Cells(lLastRow, lCol))
For Each c In rCol
If IsNumeric(c.Value) And Len(c.Value) 0 Then
c.Value = "'" & c.Value
End If
Next c
End Sub
===========================
--ron
|