Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
adding values if the same - SUMIF in range of cells? | Excel Worksheet Functions | |||
Sumif w/Text conversion on a range of cells | Excel Worksheet Functions | |||
SUMIF of specified cells in a range | Excel Discussion (Misc queries) | |||
SumIf and a Range of Cells | Excel Discussion (Misc queries) | |||
SUMIF - Range name to used for the "sum_range" portion of a SUMIF function | Excel Worksheet Functions |