LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default .Find .Hidden Values versus Formulas Aug2009

I do this 'cuz I don't to have to remember -4123 versus -4163 or whatever,
if bFormulas then LookIn = xlFormulas else LookIn = xlValues


Don't declare the bFormulas parameter to your function as a Boolean.
Declare the variable as the enum type that contains xlFormulas and
xlValues. Doing so will give you Intellisense support when writing the
call to the function. E.g,

Function Whatever(blah, blah, blah, LookIn As XlFindLookIn)

When you are typing in the call to Whatever and you get to the LookIn
parameter, you'll get a drop down list of the valid values for that
parameter. No need to memorize any numbers -- just pick from the list.
Note that it is perfectly legal to assign any numeric value to an enum
type, even if that enum type doesn't define that value. For example,
it is perfectly legal to use

Whatever(LookIn:=1234)

even though 1234 is not an enumerated value of XlFindLookIn. You won't
get a compiler error and you won't get a run time error. What the code
does with an invalid value is anyone's guess, but it will run in one
fashion or another. (In VBNET, you get an IsDefined method to test
whether a value is valid for a specific enum, but sadly you don't get
that in VBA.)

In addition to using the built in enum data types, you can create your
own and get intellisense support for working with them. See
http://www.cpearson.com/Excel/Enums.aspx for more detail.


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Fri, 28 Aug 2009 17:06:02 -0700, Neal Zimm
wrote:

Matthew -
Thanks. We agree.
I use much the same optional variables as you in the sub statement with
this exception, and I did read that your look at the code was brief.

I use boolean variables where there are two choices e.g.
optional bFormulas as boolean = true

in the code:
if bFormulas then LookIn = xlFormulas else LookIn = xlValues

I do this 'cuz I don't to have to remember -4123 versus -4163 or whatever,
when I type the call Macro(xxxx xxxx xxxx statement and the optional
stuff appears.

i can remember bFormulas; true or false better

Thanks again.

 
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
.Find method with numeric and date values, Aug2009 Neal Zimm Excel Programming 9 August 27th 09 08:09 PM
Set Find to look in Values instead of Formulas by default? Maury Markowitz[_2_] Excel Programming 3 March 6th 09 06:09 PM
Adjusting rows versus columns for formulas [email protected] Excel Programming 1 April 10th 08 11:35 AM
how to find if an excel sheet has any hidden values in a cell in VB.NET sparrow[_2_] Excel Programming 4 August 14th 06 06:41 AM
How do I avoid referencing hidden values in formulas like OFFSET? K Excel Worksheet Functions 2 July 14th 06 08:46 PM


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