Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default How to check if a certain function is used

Hi

What's the best way to check if a certain spreadsheet function is used in a
cell?
For instance, we want to check if cell A1 uses SUM function considering that
A1 may contain:
1. A1 ="Sum"
2. A1 =SUM(B1:B2)
3. A1 =If(A1="Sum","True",SUM(B1:B2))
These is not a complete list of possibilities. I just wanted to show that
search a formula string for certain words is not the best solution.
Any ideas?

Kind regards
IgorM

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default How to check if a certain function is used

Sub dk()
MsgBox Range("B2").Formula
End Sub

Will give you the formula used in B2.


"IgorM" wrote in message
...
Hi

What's the best way to check if a certain spreadsheet function is used in
a cell?
For instance, we want to check if cell A1 uses SUM function considering
that A1 may contain:
1. A1 ="Sum"
2. A1 =SUM(B1:B2)
3. A1 =If(A1="Sum","True",SUM(B1:B2))
These is not a complete list of possibilities. I just wanted to show that
search a formula string for certain words is not the best solution.
Any ideas?

Kind regards
IgorM



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to check if a certain function is used

You'll have to do your own parsing and if you have any User Defined Functions,
it can be difficult (for me, impossible) to be accurate.

Option Explicit
Function myFunc(str as string)
myfunc = application.evaluate(str)
end function

And this in a cell:
=myeval("sum(a1:a3)")
or:
=myeval("s"&CHAR(117)&CHAR(54*2+1)&"(a1:a3)")


IgorM wrote:

Hi

What's the best way to check if a certain spreadsheet function is used in a
cell?
For instance, we want to check if cell A1 uses SUM function considering that
A1 may contain:
1. A1 ="Sum"
2. A1 =SUM(B1:B2)
3. A1 =If(A1="Sum","True",SUM(B1:B2))
These is not a complete list of possibilities. I just wanted to show that
search a formula string for certain words is not the best solution.
Any ideas?

Kind regards
IgorM


--

Dave Peterson
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
Check for # of Words in Function msnyc07 Excel Worksheet Functions 2 February 14th 10 02:03 AM
Function to Check Borders Marco Excel Programming 18 November 7th 08 12:20 AM
Check my IF function KH_GS Excel Worksheet Functions 7 April 6th 06 09:28 AM
check box function? scott Excel Worksheet Functions 1 December 29th 05 07:58 PM
Check if within Function Wizard patochem Excel Programming 0 October 8th 04 02:58 PM


All times are GMT +1. The time now is 02:45 PM.

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"