Friday, October 3, 2008

Macro to change sign of active cell row values

This macro is almost the same as the macro to change sign of active cell column values. I have just changed the row codes to column codes, and vice versa. The previous macro would select active cells from top to bottom, whereas this will select cells to the right.

Sub Changerowtoneg()
Dim colcnt As Long
ActiveSheet.range(ActiveCell, ActiveCell.End(xlToRight)).Select
colcnt = Selection.Columns.Count
For i = 1 To colcnt
ActiveCell.Cells(1, i).FormulaR1C1 = ActiveCell.Cells(1, i) * (-1)
Next i

End Sub

No comments: