Skip to content

Instantly share code, notes, and snippets.

@jonschoning
Created August 30, 2011 15:12
Show Gist options
  • Save jonschoning/1181130 to your computer and use it in GitHub Desktop.
Save jonschoning/1181130 to your computer and use it in GitHub Desktop.
SelectionMultipliers.bas
Attribute VB_Name = "Module1"
Sub DblVals()
Attribute DblVals.VB_ProcData.VB_Invoke_Func = "D\n14"
Dim cell As Range
For Each cell In Selection
If (cell.Value > 0) Then
cell.Value = (cell.Value * 2#)
End If
Next
End Sub
Sub HalveVals()
Attribute HalveVals.VB_ProcData.VB_Invoke_Func = "H\n14"
Dim cell As Range
For Each cell In Selection
If (cell.Value > 0) Then
cell.Value = (cell.Value / 2#)
End If
Next
End Sub
Sub TripleVals()
Dim cell As Range
For Each cell In Selection
If (cell.Value > 0) Then
cell.Value = (cell.Value * 3#)
End If
Next
End Sub
Sub OneThirdVals()
Dim cell As Range
For Each cell In Selection
If (cell.Value > 0) Then
cell.Value = (cell.Value / 3#)
End If
Next
End Sub
Sub CalcPct()
Attribute CalcPct.VB_ProcData.VB_Invoke_Func = "P\n14"
Application.StatusBar = (Selection(1) * 1#) / Selection(Selection.Count)
End Sub
Sub CalcPctChange()
Attribute CalcPctChange.VB_ProcData.VB_Invoke_Func = "G\n14"
Application.StatusBar = (Selection(Selection.Count) - Selection(1) * 1#) / Selection(1)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment