This macro can be used to change sign of column values. Before running this macro, select the first cell of the column. And when you run it, the macro will change the sign of the values in that range. (Macro will stop at a blank row)
For example, if you had a column with values
1
2
-1
2,
the macro will change the column values to
-1
-2
1
-2
The code for this macro is
Sub Changecoltoneg()
Dim rowcnt As Long
ActiveSheet.range(ActiveCell, ActiveCell.End(xlDown)).Select
rowcnt = Selection.Rows.Count
For i = 1 To rowcnt
ActiveCell.Cells(i).FormulaR1C1 = ActiveCell.Cells(i) * (-1)
Next i
End Sub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment