Home > Macros > Negative Cell Value

Negative Cell Value

February 4th, 2009 Leave a comment Go to comments

This macro takes whatever values are in a selected range of cells and multiplies them by -1. This is especially useful for accountants who might get a list of client data as absolute values. In accounting world, however, the debits and credits might need to have a sign reversed. With this macro, just select the cells you want reversed, and run the macro.

Copy all of the code below. Paste it into your workbook’s Visual Basic editor, either under a Microsoft Excel Object or Module.

Need help? Use our nifty guide to help figure out how to install and use your macros.

Sub negative_cell_value()
'MACROS BY EXCELZOOM.COM
'Makes data negative in selected cells
Dim cell As Range
For Each cell In Selection
If cell <> "" Then
cell.Value = cell.Value * -1
Else
'skip blank cells, or they'll get set to zero
End If
Next
End Sub

Categories: Macros Tags: ,
  1. No comments yet.
  1. No trackbacks yet.