LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to find and sub total a specific number of cell above the target cell

Try this. It uses the SUM function but adjusts as necessary.

'=============================================
Sub test()
Dim FoundCell As Object
With ActiveSheet.Columns(1)
Set FoundCell = .Find("Summary", LookIn:=xlValues)
If Not FoundCell Is Nothing Then
FirstAddress = FoundCell.Address
Do
ActiveSheet.Cells(FoundCell.Row, 2).FormulaR1C1 = _
"=SUM(R[-3]C:R[-1]C)"
Set FoundCell = .FindNext(FoundCell)
Loop While Not FoundCell Is Nothing _
And FoundCell.Address < FirstAddress
End If
End With
End Sub
'=============================================


---
Message posted from http://www.ExcelForum.com/

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL FIND A SPECIFIC TOTAL KUNA Excel Worksheet Functions 4 May 14th 09 01:45 AM
Target cell reference moves when target is cut and pasted Illya Teideman Excel Discussion (Misc queries) 5 May 31st 07 11:34 AM
total of cells that are next to a cell that contains specific text suziQ Excel Worksheet Functions 1 March 1st 07 04:41 PM
Can I total only a % of a number (cell) base on total of all cel Douglas Excel Discussion (Misc queries) 2 October 6th 06 09:52 PM
Count number of times a specific number is displayed in a cell ran subs Excel Worksheet Functions 1 June 27th 05 05:01 PM


All times are GMT +1. The time now is 01:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"