If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Customizing the "Find" Command

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-30-04, 16:28
aaroncoppersmit aaroncoppersmit is offline
Registered User
 
Join Date: Feb 2004
Posts: 13
Customizing the "Find" Command

I use the Find command quite often in my company's workbooks (example: finding a project number from our project list by typing in the project name). Now, 99% of the time I am looking for something in a value, not a formula (I think this is probably true for most users). The "Find" Dialog Box always defaults to look in formulas, and I always have to manually change the dialog to look in values.

Does anyone know how to change the defaults for the dialog box to look in values? Or is there a way to get around this in a macro?

Thanks,

Aaron
Reply With Quote
  #2 (permalink)  
Old 07-01-04, 11:38
ioclio ioclio is offline
Registered User
 
Join Date: Jun 2004
Location: Italy
Posts: 15
hi Aaron,
sorry but I'm in a hurry, you can try with this:

- set up a macro with a shortcut association
[code]
WhatImlookingFor = InputBox(Prompt:="What are you looking for?", Title:="Find Values")
Dim X As Range
Set X = Cells.Find(what:=WhatImlookingFor, After:=ActiveCell, LookIn:=xlValues, _ lookat:= xlWhole)
MsgBox X.Address
[/cde]
This will provide the first cell which matches your search condition...of course you can refine it a lot...Enjoy.
FatherXmas
Reply With Quote
  #3 (permalink)  
Old 07-01-04, 11:39
ioclio ioclio is offline
Registered User
 
Join Date: Jun 2004
Location: Italy
Posts: 15
ops,
I forgot to say you need to run the macro using the previously defined shortcut...
Reply With Quote
  #4 (permalink)  
Old 07-02-04, 11:23
aaroncoppersmit aaroncoppersmit is offline
Registered User
 
Join Date: Feb 2004
Posts: 13
Hung up in the debugger

FatherXmas,

Thanks for the code. This looks like it will the perfect solution! However, I tried it, and it got hung up in the debugger. This is my macro:

Sub Find_value()
'
' Find_value Macro
' Macro recorded 7/2/2004 by Aaron Coppersmith
'

'
WhatImlookingFor = InputBox(Prompt:="What are you looking for?", Title:="Find Values")
Dim X As Range
Set X = Cells.Find(what:=WhatImlookingFor, After:=ActiveCell, LookIn:=xlValues, lookat:=xlWhole)
MsgBox X.Address
[/cde]
End Sub

The message that I got was:

Run-time error '91'
Object variable or With block variable not set.

Do you know how to get past this?

Thanks!

Aaron
Reply With Quote
  #5 (permalink)  
Old 07-02-04, 11:36
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
Your probably getting this when X is Nothing

try putting an if statement in something like

If Not X Is Nothing Then
msgbox X.Address()
else
msgbox "address not found"
end if

HTH

David
Reply With Quote
  #6 (permalink)  
Old 07-02-04, 12:09
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
There is an XL add-in that is perfect, and you can choose whether to look in cells with formulas or with constants. And it allows you to work with objects as well.

It is called FlexFind, by Jan Pieterse (hosted on Stephen Bullen's site)

http://www.bmsltd.co.uk/

(although his site is temporarily down).

Or try this site:

http://www.jkp-ads.com/Download.htm#Flexfind
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums

Last edited by shades; 07-02-04 at 12:11.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On