Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Range value cells with Sumif

Strange request - Is there a way to programmatically find any cell that has
a sumif formula in it, and value the contents of that cell?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Range value cells with Sumif

Something like this?

Public Sub FindSumIf()
Dim wks As Worksheet
Dim rngToSearch As Range
Dim rngCurrent As Range
Dim rngResult As Range
Dim rngFirst As Range

Set wks = Sheets("Sheet1")
Set rngToSearch = wks.Cells
Set rngCurrent = rngToSearch.Find("Sumif", , xlFormulas)

If rngCurrent Is Nothing Then
MsgBox "Not Found"
Else
Set rngResult = rngCurrent
Set rngFirst = rngCurrent
Do
Set rngResult = Union(rngCurrent, rngResult)
Set rngCurrent = rngToSearch.FindNext(rngCurrent)
Loop Until rngCurrent.Address = rngFirst.Address
rngResult.Select
End If

For Each rngCurrent In rngResult
MsgBox rngCurrent.Value
Next rngCurrent
End Sub
--
HTH...

Jim Thomlinson


"Steph" wrote:

Strange request - Is there a way to programmatically find any cell that has
a sumif formula in it, and value the contents of that cell?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Range value cells with Sumif

Oops... The for next with the message box was out of place...

Public Sub FindSumIf()
Dim wks As Worksheet
Dim rngToSearch As Range
Dim rngCurrent As Range
Dim rngResult As Range
Dim rngFirst As Range

Set wks = Sheets("Sheet1")
Set rngToSearch = wks.Cells
Set rngCurrent = rngToSearch.Find("Sumif", , xlFormulas)

If rngCurrent Is Nothing Then
MsgBox "Not Found"
Else
Set rngResult = rngCurrent
Set rngFirst = rngCurrent
Do
Set rngResult = Union(rngCurrent, rngResult)
Set rngCurrent = rngToSearch.FindNext(rngCurrent)
Loop Until rngCurrent.Address = rngFirst.Address
rngResult.Select
For Each rngCurrent In rngResult
MsgBox rngCurrent.Value
Next rngCurrent
End If


End Sub

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

Something like this?

Public Sub FindSumIf()
Dim wks As Worksheet
Dim rngToSearch As Range
Dim rngCurrent As Range
Dim rngResult As Range
Dim rngFirst As Range

Set wks = Sheets("Sheet1")
Set rngToSearch = wks.Cells
Set rngCurrent = rngToSearch.Find("Sumif", , xlFormulas)

If rngCurrent Is Nothing Then
MsgBox "Not Found"
Else
Set rngResult = rngCurrent
Set rngFirst = rngCurrent
Do
Set rngResult = Union(rngCurrent, rngResult)
Set rngCurrent = rngToSearch.FindNext(rngCurrent)
Loop Until rngCurrent.Address = rngFirst.Address
rngResult.Select
End If

For Each rngCurrent In rngResult
MsgBox rngCurrent.Value
Next rngCurrent
End Sub
--
HTH...

Jim Thomlinson


"Steph" wrote:

Strange request - Is there a way to programmatically find any cell that has
a sumif formula in it, and value the contents of that cell?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Range value cells with Sumif


This should give you a place to start.

What do you want to do with the values of each cell that contains
=SumIf function?

HT

--
bhofset
-----------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...fo&userid=1880
View this thread: http://www.excelforum.com/showthread.php?threadid=38140

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
adding values if the same - SUMIF in range of cells? Eisaz Excel Worksheet Functions 4 November 18th 08 05:05 AM
Sumif w/Text conversion on a range of cells WRH Excel Worksheet Functions 5 October 26th 08 11:51 PM
SUMIF of specified cells in a range Bretter99 Excel Discussion (Misc queries) 7 April 8th 08 12:18 PM
SumIf and a Range of Cells Erika Excel Discussion (Misc queries) 5 May 9th 07 04:53 PM
SUMIF - Range name to used for the "sum_range" portion of a SUMIF function Oscar Excel Worksheet Functions 2 January 11th 05 11:01 PM


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