Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula using a SUM of 3 code-defined cells


I have a total line I have inserted into my spreadsheet.

The activecell in column A is offset by (0,2) to reach the destinatio
for the formula.

In that active cell I need to SUM the values of the cells reference
by
(1)

CODE
Selection.Find(What:="Committed Allocations Total", After:=ActiveCell
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext
_
MatchCase:=False).Offset(0, 2).Activate
and (2)

CODE
Selection.Find(What:="Committed Projects Total", After:=ActiveCell
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext
_
MatchCase:=False).Offset(0, 2).Activate

and (3)

CODE
Selection.Find(What:="Very Likley Projects Total", After:=ActiveCell
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext
_
MatchCase:=False).Offset(0, 2).Activate
and (4)

CODE
Selection.Find(What:="Unplanned Very Likely Total", After:=ActiveCell
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext
_
MatchCase:=False).Offset(0, 2).Activate

so I need to have the sum of (1)+(2)+(3)+(4) and then fill this acros
12 columns.

how can I acheive this?

thanks in advance..

--
matp
-----------------------------------------------------------------------
matpj's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=48385

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formula using a SUM of 3 code-defined cells

Dim rng1 as range, rng2 as Range, rng3 as Range, rng4 as Range
set rng1 = Selection.Find(What:="Committed Allocations Total", _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
Set rng2 = Selection.Find(What:="Committed Projects Total", _
After:=ActiveCell)
set rng3 = selection.Find(What:="Very Likley Projects Total", _
After:=ActiveCell)
set rng4 = Selection.Find(What:="Unplanned Very Likely Total", _
After:=ActiveCell)
if not rng1 is nothing then set rng1 = rng1.offset(0,2)
if not rng2 is nothing then set rng2 = rng2.offset(0,2)
if not rng3 is nothing then set rng3 = rng3.offset(0,2)
if not rng3 is nothing then set rng4 = rng4.offset(0,2)

ActiveCell.Offset(0,2).Resize(1,12).Formula = _
"=" & rng1.Address(1,0) & "+" & _
rng2.Address(1,0) & "+" & _
rng3.Address(1,0) & "+" & _
rng4.Address(1,0)

--
Regards,
Tom Ogilvy


"matpj" wrote in
message ...

I have a total line I have inserted into my spreadsheet.

The activecell in column A is offset by (0,2) to reach the destination
for the formula.

In that active cell I need to SUM the values of the cells referenced
by
(1)

CODE
Selection.Find(What:="Committed Allocations Total", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False).Offset(0, 2).Activate
and (2)

CODE
Selection.Find(What:="Committed Projects Total", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False).Offset(0, 2).Activate

and (3)

CODE
Selection.Find(What:="Very Likley Projects Total", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False).Offset(0, 2).Activate
and (4)

CODE
Selection.Find(What:="Unplanned Very Likely Total", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False).Offset(0, 2).Activate

so I need to have the sum of (1)+(2)+(3)+(4) and then fill this across
12 columns.

how can I acheive this?

thanks in advance...


--
matpj
------------------------------------------------------------------------
matpj's Profile:

http://www.excelforum.com/member.php...o&userid=21076
View this thread: http://www.excelforum.com/showthread...hreadid=483858



Reply
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
Ghost code from User-defined Add-Ins feltra Excel Discussion (Misc queries) 1 July 6th 07 12:16 PM
defined sheet formula to vb code [email protected] Excel Discussion (Misc queries) 2 November 28th 06 08:02 PM
Application-Defined or Object-Defined Error on simple code Fid[_2_] Excel Programming 1 July 21st 05 08:30 PM
Application-Defined or Object-Defined Error on simple code [email protected] Excel Programming 6 February 22nd 05 09:03 PM
code to delete a defined name helmekki[_15_] Excel Programming 2 August 2nd 04 09:32 PM


All times are GMT +1. The time now is 10:41 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"