Skip to content

Instantly share code, notes, and snippets.

@bnjcbsn
Created December 19, 2017 22:45
Show Gist options
  • Save bnjcbsn/f82436f944977ae3561a4871c141a529 to your computer and use it in GitHub Desktop.
Save bnjcbsn/f82436f944977ae3561a4871c141a529 to your computer and use it in GitHub Desktop.
Excel VBA, replace highlighted cells with their average
Public Sub spreads()
' no error traps!! YOYO
scnt = Selection.Count
ssum = Application.WorksheetFunction.Sum(Selection)
pastingValue = ssum / scnt
Selection.Value = pastingValue
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment