Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Sean Anderson   on Sep 24 In MS Office Category.

  
Question Answered By: Kerry Wright   on Sep 24

See if this fits the bill;

Sub SumSelectedCells()
aRandomNumber = 1
CellsToSum = Selection.Address
LastInRange = Selection.Rows.Count
vSum = WorksheetFunction.Sum(Range(CellsToSum))
Range(CellsToSum)(LastInRange).Offset(0, 2).Value = vSum / vRan
End Sub


You can replace the 'aRandomNumber' value with whatever you want!
You can add additional logic to check if the selection IS in columnA with:

vColumnSelected=range(CellsToSum).columns.column
If Column =1 then
SumSelectedCells
endif

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Conditional Summing Or get search suggestion and latest updates.


Tagged: