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: Alberta Miller   on Sep 24

If you really need to have the result on the last user-selected row,
then you will need to do the following:

Logic statement:
' User selects a range in column A, and then presses the "Do Column C
Now" button.
' Determine the top and bottom rows the user has selected.
' Put the formula in the correct row in Column C, using offset.

Actual Code:
Sub DoColumnCNow()

Dim Start_Row, Number_Of_Rows As Integer

' Determine the top and bottom rows the user has selected.
Start_Row = Selection.Row
Number_Of_Rows = Selection.Rows.Count


' Put the formula in the correct row in Column C, using offset.
Range("A" & Start_Row).Offset(Number_Of_Rows - 1, 2).Formula =
"=SUM(""A" & Start_Row & ":A" & Start_Row + Number_Of_Rows - 1 & "") /
2000


End Sub
------------------------------------------------------------------------
-----------
Now, my formula has a mistake in. See if you can fix the compile error,
and it will work. Or anyone else, please. Too late for my brain today.

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: