Skip to content

Instantly share code, notes, and snippets.

@ateneva
Last active April 16, 2017 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateneva/10dd4cf17b1596895be07d0e5fa3ab73 to your computer and use it in GitHub Desktop.
Save ateneva/10dd4cf17b1596895be07d0e5fa3ab73 to your computer and use it in GitHub Desktop.
Restate values by multiplication (will also work for all math operations)
Sub MultiplyValues()
Dim Cell As Range
Dim prv As Double
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'written by Angelina Teneva, September 2016
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'multiplies by a 1000
For Each Cell In ActiveSheet.Range("J2:J" & ActiveSheet.UsedRange.Rows.Count).SpecialCells(xlCellTypeVisible)
prv = Cell.Value
Cell.Value = prv * 1000 '*(-1)
Next Cell
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'make values negative
For Each Cell In ActiveSheet.Range("AV:AV", "AX:AX")
If IsNumeric(Cell) And Cell.Value <> 0 Then
prv = Cell.Value
Cell.Formula = prv * -1
End If
Next Cell
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment