macro

G

greg

Hi
how can I convert a field that has an ' before the number, for example
'4578 i would like to convert it to 4578
Greg
 
N

Norman Jones

Hi Greg,

For a VBA solution, try:

'=============>>
Public Sub DeleteApostrophes()
Dim WB As Workbook
Dim SH As Worksheet
Dim rCell As Range

Set WB = Workbooks("YourBook.xls") '<<===== CHANGE
Set SH = WB.Sheets("Sheet1") '<<===== CHANGE
Set rng = SH.Range("A1:A20") '<<===== CHANGE

For Each rCell In rng
If rCell.PrefixCharacter = "'" Then
rCell.Value = rCell.Value
End If
Next rCell

End Sub
'<<=============
 
C

CLR

Try left-click on an empty unused cell, then left-click the Format Painter
icon in the upper toolbar, then left-click on the target cell(s)


Vaya con Dios,
Chuck, CABGx3
 
D

Dave Peterson

I like this technique:

Select an empty cell
edit|Copy
select the range of offending cells
edit|Paste special|check Add
 
C

CLR

Quite Cool Norman.........and in a nifty format that's "reusable" for future
tasks as well just by changing the IF statement........a keeper here, thanks
for the post.

Vaya con Dios,
Chuck, CABGx3
 
Top