Help!: Converting "1,253-" to "-1,253"

  • Thread starter Thread starter japorms
  • Start date Start date
J

japorms

Guys,

Can anybody help me convert a number say, "1,253-" to "-1,253"

Let's say that the data is in column G.

The database usually put the negative sign at the end and excel read
this as text.

I hope somebody can help me create a macro for this.

:)
 
Select the cells with the data you want to change, then run the
following macro:

Sub ChangeNeg()
Dim Rng As Range
Dim Pos As Long
For Each Rng In Selection.Cells
If Right(Rng.Text, 1) = "-" Then
Rng.Value = Left(Rng.Text, Len(Rng.Text) - 1) * -1
End If
Next Rng
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"japorms" <[email protected]>
wrote in message
news:[email protected]...
 
Thanks Guys!

You all have very helpful.

Its working perfectly.

I use the one Chip suggested. Thanks Chip!

:)
 
Back
Top