luke1438
02-19-2008, 02:15 PM
I am bringing data in from an accounting program and it is putting the negative sign at the end of the number instead of at the front of the number so Excel is reading it as a text cell. I have been trying to figure out some way to run a macro that will move the dash from the back to the front of the number. Any suggestions would be helpful.
Thanks
Luke
Bob Phillips
02-19-2008, 02:35 PM
Public Sub Test()
Dim LastRow As Long
Dim i As Long
With ActiveSheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow
If Right$(.Cells(i, "A").Value, 1) = "-" Then
.Cells(i, "A").Value = Right$(.Cells(i, "A").Value, 1) & Left$(.Cells(i, "A").Value, Len(.Cells(i, "A").Value) - 1)
End If
Next i
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End With
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.