Need to move - from end of number to beginning

G

Giggly4g

Hi! I've got a large workbook containing many numbers that should be
negative. For some reason, the - is showing up at the end of the number. I
believe the document was converted to Excel. Anyway, I want to quickly move
the - from the end to the beginning of the number, then format the cell as
number. Any ideas how to do that?
 
R

Ron Rosenfeld

Hi! I've got a large workbook containing many numbers that should be
negative. For some reason, the - is showing up at the end of the number. I
believe the document was converted to Excel. Anyway, I want to quickly move
the - from the end to the beginning of the number, then format the cell as
number. Any ideas how to do that?

Select the cells, one column at a time.

Then Select Data/Text to columns (or on the Data tab of 2007)

At step 3 of the Wizard, select Advanced and ensure that "Trailing minus for
negative numbers" is Set.

Finish.
--ron
 
D

David Biddulph

Data/ Text to columns/ ... should do the trick. One stage of the wizard has
an Advanced menu, including the option for trailing minus (which may be set
by default).
 
M

muddan madhu

Use this ....

Select the range first ..


Sub reverse()

For Each r In Selection
With r
.Value = -(.Value)
End With
Selection.Value = -r
Next r
End Sub
 
G

Giggly4g

Excel doesn't like .Value = -(.Value)

I tried using (.Value)- since the - is at the end. Didn't work. I'm getting
a syntax error message.

I'd try using text to columns but there are over 800 columns to do.
 
R

Ron Rosenfeld

I'd try using text to columns but there are over 800 columns to do.

Try this sub, then:

=========================
Option Explicit
Sub TrailingNeg()
Dim c As Range
For Each c In Cells.SpecialCells(xlCellTypeConstants)
With c
If IsNumeric(.Value) And _
Right(.Value, 1) = "-" Then
.Value = Val(.Value) * -1
End If
End With
Next c
End Sub
===========================
--ron
 
M

muddan madhu

try this

.value = .value

It's working ...

Excel doesn't like .Value = -(.Value)

I tried using (.Value)- since the - is at the end. Didn't work. I'm getting
a syntax error message.

I'd try using text to columns but there are over 800 columns to do.









- Show quoted text -
 
Top