conversion
Private Sub CommandButton1_Click()
Dim Cell As Range
For Each Cell In ActiveSheet.Range("G:G")
Cell = nConvert(Cell.Value)
Next Cell
End Sub
Function nConvert(str As String) As String
If str < "" Then nConvert = Left(str, Len(str) - Len(Right(str, 2))) & "."
& Right(str, 2)
End Function
"Hemant_india" wrote:
hi
i have written follwing code
Private Sub CommandButton1_Click()
Dim rng As Range
Set rng = ActiveSheet.Range("g:g")
For Each col In rng
col.Value = nconvert(col.Text)
Next col
'TextBox1.Text = nconvert("3500000")
End Sub
====
Function nconvert(tsh) As String
If tsh < 0 Then ' Evaluate argument.
Exit Function ' Exit to calling procedure.
Else
leftside = Left(tsh, Len(tsh) - Len(Right(tsh, 2)))
nconvert = CStr(leftside) & "." & CStr(Right(tsh, 2))
End If
End Function
my problem is if this code is run again and again
amount will go on reducing
please suggest otherwise
--
hemu
|