View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default macro to look down cells and if negative in the right of the cell

Sould of asked yesterday.

Sub movetofront()
ActiveSheet.Activate
LastRow = Cells(Rows.Count, ActiveCell.Column). _
End(xlUp).Row
Set ColumnRange = Range(Cells(1, ActiveCell.Column), _
Cells(LastRow, ActiveCell.Column))

For Each cell In ColumnRange

If (Not IsEmpty(cell)) And (cell.Text < "") Then
If InStr(cell, "-") 0 Then
If Right(cell, 1) = "-" Then
cell.Value = -1 * Val(cell)
End If
End If
End If
Next cell

End Sub

" wrote:

Hi

I have a column of data.

Unfortunately the negative symbol is on the right of the numbers to
represent a negative number.

What I need is a macro to look down a column and if it find the first
character to the right of that cell is a "-" symbol then move that to
the first character on the left of the cell to make the numbers
negative.

I hope this is possible and someone can help,

Many thanks,

Stuart