View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default converting number to dollar

A revised version to handle first row not being row 1...

Sub ParseCurrency()
Dim vData, vTmp, n&, lStart&, lEnd&, lCol&
With Selection: lStart = .Row: lCol = .Column: End With
lEnd = Cells(Rows.Count, Selection.Column).End(xlUp).Row

vData = Range(Cells(lStart, lCol), Cells(lEnd, lCol))
For n = LBound(vData) To UBound(vData)
vTmp = Split(vData(n, 1), ": ")
vData(n, 1) = Replace(vTmp(1), "*", "")
Next 'n
With Range(Cells(lStart, lCol), Cells(lEnd, lCol))
.Value = vData: .Style = "Currency"
End With
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion