Search and select a cell when pressing enter

  • Thread starter Thread starter bartman1980
  • Start date Start date
B

bartman1980

I want to make a some kind of CTRL-F field in my sheet.

If the text (or a part of the text) in cell F1 is found in row A then
select the cell with the text where it was found.
And when I'm in the cell F1, I prefer just to press 'enter' instead of
clicking on a button.

Does somebody have an example?
 
right click the sheet tab>view code>left window select worksheet>right
window select worksheet_change>put your FIND code there
 
right click the sheet tab>view code>left window select worksheet>right
window select worksheet_change>put your FIND code there

--
Don Guillett
Microsoft MVP Excel
SalesAid Software







- Tekst uit oorspronkelijk bericht weergeven -

I know how to get in the VBA editor, but do you have this FIND code
for me?
 
Easy to do it for you but why not look in the vba help index for FIND
 
Easy to do it for you but why not look in the vba help index for FIND

--
Don Guillett
Microsoft MVP Excel
SalesAid Software






- Tekst uit oorspronkelijk bericht weergeven -

Hi Don,
I looked in the Help and I've made this code:

Sub searching()
string_searchvalue = Range("F1")
Columns("A:A").Find(What:=string_searchvalue,
After:=ActiveCell).Activate
End Sub

But this code doesn't combine numbers and letters with eachother.
And when He finds nothing, he gives an error, so I have to add an IF
nothing found then show message box "Nothing found"

I Also couldn't find the option of pressing enter instead of clicking
on the button.

Can you give me a hint?
At least I'm trying.
 
Examples of your data and what you are trying to find.
Have you tried recording a macro while doing a manual find from the edit
menu?
 
Try this. I tried with aaa23

Why do you need to "activate". You rarely need to select or activate. You
could use .copy for instance.

Sub searchA()
Columns(1).Find(Range("f1")).Activate
End Sub
 
Try this. I tried with aaa23

Why do you need to "activate". You rarely need to select or activate. You
could use .copy for instance.

Sub searchA()
Columns(1).Find(Range("f1")).Activate
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software










- Tekst uit oorspronkelijk bericht weergeven -

I just want to make a search function for the people who want to
select the right items in the list.
This selection is done by putting manually a 1 in the cell next to it.
The searchfunction you mentioned is only for finding the first item
with the search criteria. After finding the first one, he doesn't
continue to the other ones.

When I try to find 444 the code stops, I need to have a messagebox in
it which says "444 not found"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top