If you mean you want to change them within the cells they currently are in, then select column or columns that contain the cells you want to change, then press CTRL+H to bring up the Replace dialog box, put a minus sign in the "Find what" field and leave the "Replace with" field empty, press the "Options>>" button and make sure the checkbox labeled "Match entire cell contents" is not checked, then click the "Replace All" button.I would like to change a few cells that appear as negative numbers to positive numbers.
=IF(A2<0,-A2,A2)
Sub positive()
Dim r As Range
Dim c As Integer
Set r = Selection
[COLOR=#ff0000] For Each c In r[/COLOR]
[COLOR=#ff0000] If c.value < 0[/COLOR]
Then c.value = c * -1
Else
x
End If
Next
End Sub
Since I am learning VBA, I was trying to make a macro to convert all the negative number into positive numbers but due to some reason it doesn't work. The VBA seems to reject my IF statements.
Experts' assistance required.
Code:Sub positive() Dim r As Range Dim c As Integer Set r = Selection [COLOR=#ff0000] For Each c In r[/COLOR] [COLOR=#ff0000] If c.value < 0[/COLOR] Then c.value = c * -1 Else x End If Next End Sub