Need to move - from end of number to beginning

  • Thread starter Thread starter Giggly4g
  • Start date Start date
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?
 
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
 
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).
 
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
 
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.
 
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
 
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 -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top